I have a button and a textfield in a form and when its clicked the form posts to another page. Is it possible to have some JavaScript function that checks if the textfield contains a value when the button is clicked? What I want is to display a message (alert box) if the button is clicked but the field is empty. The button should only submit if the field is filled. Possible?
Thanks!
Of course this is possible. It’s even the very basics of web development.
Look at this link to learn how to validate data before submitting:
http://www.w3schools.com/js/js_form_validation.asp