Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pagelayout using Bootstrap

Posted on 2014-02-10
3
Medium Priority
?
525 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 1200 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

916 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