Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What if I validate my form by using only JavaScript?

I was making registration form for my project and I have validated it using JavaScript only, It perfectly validates every field and works pretty well. I have made the submission of the form to database fully dependent on the JavaScript i.e using hidden type input fields to capture the JavaScript validated values and be submitted to the database. If JavaScript feature is disabled nothing will be submitted to database. I couldn’t find any suitable realtime validator other than this for php form plus its my first time doing project. (The project is intended to work on local server in a company.)
So I just want to know if I am doing the right thing. Please give me your suggestions on this.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In general, you should never rely on client-side validation, because you can’t trust the client.

You can use client-side validation for real-time feedback, but always validate data on the server.

If JavaScript feature is disabled nothing will be submitted to database.

This assumes that the user only uses the interface you provided. In the background, the form submission only triggers a HTTP POST request to your server that can be modified (and sent from outside your application and thereby bypass your client-side validation completely).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading