Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web page field validation

Tags:

html

I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users.

What's the best/easiest solution. BTW: easiest scores 65% of total points

Edit: What if best was 65% of total points?

like image 526
Keng Avatar asked Jan 23 '26 16:01

Keng


2 Answers

If you would like to use JavaScript then it has built in date validation functions. However, if you do not want to go the JavaScript route, you could change the UI to dropdown controls which would limit the users ability to enter invalid data. You would still need to check server side to ensure nobody submits Feb 30th.

like image 147
AdamSane Avatar answered Jan 25 '26 05:01

AdamSane


Check out this javascript date validation function.

It uses javascript, regular expressions and the 'onblur' event of a text input.

like image 20
Dhaust Avatar answered Jan 25 '26 07:01

Dhaust



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!