Infiniti
Infiniti

Reputation: 359

Bootstrap 3 Form Validation Using built-in Styles

I would like to implement form validation using Bootstrap3's CSS (For Example: On Submit, assuming all forms are filled in correctly, display an "alert alert-success". If failed, display "alert alert-danger" containing an explanation to the failure (Ex: Please enter a valid name). Right now, all I can get to work is requiring text in a field (using HTML5 required tag) without the ability to display any alerts.

Current Code: http://pastebin.com/AjfUA26n

Website: http://infenterprises.com/contact/

Upvotes: 0

Views: 869

Answers (1)

wedi
wedi

Reputation: 1422

You will need to do two things:

  1. Do server side validation. Client side validation can be a nice help for your user, but it doesn't replace server side validation for security reasons. That being said
  2. you will need to use Javascript to do client side validation and display the result. A nice helper when using bootstrap is http://bootstrapvalidator.com/.

Upvotes: 1

Related Questions