Solved

Pagelayout using Bootstrap

Posted on 2014-02-10
3
521 Views
Last Modified: 2014-02-11
Experts,

I am designing a form (Test-Form1) similar to the attached screenshot using html5 ,bootstrap and Angularjs.The form contains 12 rows with each row contains 2 fields (label and input text box ) and below is the sampel code. I know bootstrap uses grid sytstem that appropriately scales up to 12 columns and used predefined class (form-group col-xs-6) for both label and text box to align properly .

The problem with this approach the error message will always show below the text box (Test-Form1)  because I was using all the  12 columns for both the label and text box(form-group col-xs-6).Now I was told to display error message next to text box (Test-Form2) as there is lot of space.How can I achieve this using predefined bootstrap classes?

<div class="col-xs-6 col-md-6 col-lg-6">
  
	<div class="row">
    		<label class="form-group col-xs-6">Name</label>
      		<div class="form-group col-xs-6">
                <input type="text"  id="test" placeholder="Name">

              <span class="error" ng-show="myForm.input1.$error.name">Enter valid Name</span>
               </div>
       </div>
     
       <div class="row">
               <label class="form-group col-xs-6">Age</label>
                <div class="form-group col-xs-6">
                <input type="text"  id="test" placeholder="Age">
      <span class="error" ng-show="myForm.input2.$error.age">Enter valid AGE</span>
               </div>
       </div>
    
      <div class="row">
              <label class="form-group col-xs-6">Organization</label>
              <div class="form-group col-xs-6">
               <input type="text"  id="test" placeholder="Organization">
<span class="error" ng-show="myForm.input3.$error.Organization">Enter valid Organz</span>
               </div>
       </div>

</div>

Open in new window

Test-Form1.png
Test-Form2.png
0
Comment
Question by:ksd123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
XGIS earned 400 total points
ID: 39847149
This is not the solution you are after but it may be something to consider to save even more space.... Tooltips  .. It even points directly to the textbox.. nice!!

that being said.. this looks like a suitable answer to your solution.  Adjacent Validation on JSFiddle

You may or may not be aware that you can create a file called custom.css and override the default bootstrap class without editing it. Just make sure you load your css on the pages where it is required.  This way when you update bootstrap you do not need to worry about migrating your changes.
0
 

Author Closing Comment

by:ksd123
ID: 39849413
Thank you for your suggestion
0
 
LVL 7

Expert Comment

by:XGIS
ID: 39849480
Hello ksd123.. thankyou for the points.. i hope it helped.. just to clarify my answer regarding custom css..... you need to use the same named class to override the existing class. You should not need to change the original class.  eg

custom.css

.error
{
color:red;
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question