How can I Complete form validation using js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I Complete form validation using js

1st Jul 2017, 11:52 AM
Adityaa
3 Answers
+ 3
form validation using only js (client side) may not be an ideal solution from a sec'ty point of view. Consider also server side validation and filtering. You can reference to this php form example from w3schools.com https://www.w3schools.com/php/php_form_complete.asp
1st Jul 2017, 12:14 PM
seamiki
seamiki - avatar
+ 3
thanks seamiki, but I have no knowledge of php. Can you please tell me about only client side validation because I am beginner.
2nd Jul 2017, 7:30 AM
Adityaa
+ 3
the client side can be mostly done with html5 elements and attributes. You can start escaping illegal chars from textfield entries with JS as shown in the example with php but you'll have to repeat it on the server side before sending those values to the database, to avoid sql injection. On the client side you're always vulnerable.
2nd Jul 2017, 10:02 AM
seamiki
seamiki - avatar