Form Validation

So I’ve just made my new site using bootstrap and made a pop-up form that takes details like name and address and telephone etc.

What do I need to make sure the user enters all the required fields? as in red warnings etc.

is this java script?

Thanks for your help.

@NetBoomIT You are not limited to JS; You may also do that with the required attribute defined at the given input fields and probably do the tweak with CSS as to the red warnings.

Well, I learn you are using a front-end framework (comprising CSS, HTML, & JS) which (Bootstrap) here makes the designing simpler since we only have to include Bootstrap files and mention Bootstrap’s predefined class names for our webpage elements and they will be styled automatically through Bootstrap; am new to this start- up!

JavaScript isn’t recommended for form validation as it can be easily bypassed. It is better to do it server-side, using PHP, Python or whatever.

1 Like

True, you must back it up with server-side validation to be secure.
But it’s not a bad idea to have in-page client side validation too for the convenience of the user.
It is a lot easier these days with modern browsers supporting various input types, the required and pattern attributes, so you no longer need js to do this unless you need support for old browsers.

2 Likes

Bootstrap has a validator plugin for client side validation.

I also agree that it is better to do with server-side validation. This is the most secure

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.