Solved

Pagelayout using Bootstrap

Posted on 2014-02-10
3
508 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now