Solved

Pagelayout using Bootstrap

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
project copy paste issue 1 61
CSS DIV Height in Percent 1 25
Problem to copy file 14 43
Hta File displays dynamic File names 4 43
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

685 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