Full Time Skeleton
Full Time Skeleton

Reputation: 1740

MVC Styling form errors with BootStrap 3

I am trying to figure out how to, on form submission, to trigger the following styling of form error in Bootstrap.

So the idea is the user submits the form, the controller fails validation (maybe the email address they've submitted on the form has already been used) and the user is returned to the view with the state of the erroring fields marked out thusly (i.e. with a red outline and a red X):

Bootstrap feedback form states

I've seen how to accomplish this client side but not how to trigger it server side. So the form would re-load, in this example the email field would look like the 'Input with error' field of the image attached.

Upvotes: 0

Views: 31

Answers (1)

Edney Holder
Edney Holder

Reputation: 1228

Have the server side code set a hidden variable. On the page load look at the value and detemine which if any of the error formats to use.

Upvotes: 1

Related Questions