OllieD Posted March 14, 2015 Share Posted March 14, 2015 I have st up a form on my website for contacting my company. It has some required fields for name, email and message but when you click the submit button, an alert pops up to confirm the form being submitted even when the required fields haven't been filled out. How can I solve this? This is the code for the form: <form name="Contact" method="put" id="contact"> First Name: <input type="type" name="First" id="first" maxlength="20" required placeholder="First Name"> <br> Last Name: <input type="type" name="Last" id="last" maxlength="25" required placeholder="Last Name"> <br> Email: <input type="email" name="Email" id="email" maxlength="25" required placeholder="Email"> <br> Message <input type="type" name="Message" id="message" maxlength="1000" required placeholder="Message"> <br> <input type="reset"> <input type="submit" onClick="alert('Thank you for contacting us. We will process it as soon as possible')"> </form> Link to comment Share on other sites More sharing options...
Ingolme Posted March 14, 2015 Share Posted March 14, 2015 You need Javascript to look at the fields when the form submit event fires and check that they have a proper value. Link to comment Share on other sites More sharing options...
OllieD Posted March 14, 2015 Author Share Posted March 14, 2015 Ok thanks, as a novice, how do I do that? Link to comment Share on other sites More sharing options...
Ingolme Posted March 14, 2015 Share Posted March 14, 2015 Start by reading the Javascript tutorial. Link to comment Share on other sites More sharing options...
OllieD Posted March 14, 2015 Author Share Posted March 14, 2015 Ok Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now