Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Bootstrap Basics Building Forms With Bootstrap Add Custom CSS to Your Bootstrap Site

Beau Hale
Beau Hale
13,254 Points

How do i exclude fields in modal form from validation?

I applied validation to the modal form but I dont need the entire form to require validation. I would like 'Basic info' and 'Payment Info' to require validation but not 'Which Topic Interests You Most'. Am i applying it wrong or do i need to do some custom CSS?

In the video, it looks like he has only 2 random fields that need to be validated. I can't figure out how to do only fields i want and not all the form fields

1 Answer

I know this is not a short answer, but I think the explanation on how validation should be applied here is pretty straightforward and easy to understand: https://getbootstrap.com/docs/4.0/components/forms/#validation

basically adding the necessary classes (and if you want to use custom messaging attributes) to the parent element of th fields you'd like to validate (usually the <form> node) makes it easy to then select the elements you'd like to add validation to.