New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Updating your forms

From: Bootstrap 3: New Features and Migration

Video: Updating your forms

The big thing about forms is that all form controls, including input, text area, and select element, are set to 100 width by default. So you can see the difference right here. You'll see that this field takes up the whole width of the container, whereas in the old version of Bootstrap, it would just default to a certain width. That's certainly more mobile friendly, so that's a great upgrade. Something you'll have to watch out for is that because all widths default to 100%, to use inline forms, you'll have to set the width of the form controls manually. One of the cool features of Bootstrap is the ability to create horizontal forms. Where the labels and fields are side by side.

Updating your forms

The big thing about forms is that all form controls, including input, text area, and select element, are set to 100 width by default. So you can see the difference right here. You'll see that this field takes up the whole width of the container, whereas in the old version of Bootstrap, it would just default to a certain width. That's certainly more mobile friendly, so that's a great upgrade. Something you'll have to watch out for is that because all widths default to 100%, to use inline forms, you'll have to set the width of the form controls manually. One of the cool features of Bootstrap is the ability to create horizontal forms. Where the labels and fields are side by side.

In the new Bootstrap, this is treated like any other layout, so you create a form with a class of form-horizontal, and then you use the col, col-lg, and then a number, just like this right here. Now this is different than the old version of Bootstrap, where you used to create a series of control groups. This makes a lot more sense now but it's definitely different than before so it means that you should check the forms on your old Bootstrap website if you're upgrading. One thing that you'll notice throughout the Bootstrap upgrade is a series of warnings like this one right here. This one tells you, for example, that inputs will only be fully styled if they're type attribute is properly declared.

Now that used to be true of the old version of Bootstrap, but there was no warning, so you sort of found out about these kind of problems by trial and error, so it's nice to see them available by default on the documentation. Something else that changes is checkboxes and radio buttons. In the old version of Bootstrap, you used to define checkboxes by adding a check box class to your labels and wrapping your input fields. It's a bit different in the new version, you still wrap your input fields but you also wrap another separate div with the check box class. Inlining forms is also a bit different. Instead of two classes for checkbox and inline, you use a separate checkbox inline and checkbox radio class.

You can now disable not just an individual control, but also an entire field set. You have to be careful because this won't work in IE or Safari. The rest of the form changes in this section are pretty much the same things applied to other elements. Classes have been simplified and hyphenated, layouts are done with columns, and classes have been renamed. If you've been using a lot of the functionality in forms, you'll be doing a lot of updating when you upgrade.

Show transcript

This video is part of

Image for Bootstrap 3: New Features and Migration
Bootstrap 3: New Features and Migration

21 video lessons · 5188 viewers

Ray Villalobos
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.