KateMacwil Posted April 24, 2018 Share Posted April 24, 2018 Hi I have tried to write some js code to validate the fields on my form and Im doing something wrong and can't figure out what it is. Here is my form code: <form name="Form1" action=""> <table id="form_corners"> <tr> <td>Name:</td> <td><input type="text" id="name" name="name" size="50" maxlength="60" onblur="ValidateField(name)" /></td> </tr> <tr> <td>Email:</td> <td><input type="text" id="email" name="email" size="50" maxlength="60" onblur="ValidateField(email)" /></td> </tr> <tr> <td width="120">Phone #:</td> <td><input type="text" id="phone" name="phone" size="50" maxlength="60" onblur="ValidateField(phone)" /></td> </tr> <tr> <td valign="top">Note:</td> <td><textarea id="note" name="note" rows="3" cols="39"></textarea></td> </tr></table> <br/> <div align="center"> <input id="submit-btn-contact" type="submit" value="Send Now"> </div> </form> <form name="Form1" action=""> <table id="form_corners"> <tr> <td>Name:</td> <td><input type="text" id="name" name="name" size="50" maxlength="60" onblur="ValidateField(name)" /></td> </tr> <tr> <td>Email:</td> <td><input type="text" id="email" name="email" size="50" maxlength="60" onblur="ValidateField(email)" /></td> </tr> <tr> <td width="120">Phone #:</td> <td><input type="text" id="phone" name="phone" size="50" maxlength="60" onblur="ValidateField(phone)" /></td> </tr> <tr> <td valign="top">Note:</td> <td><textarea id="note" name="note" rows="3" cols="39"></textarea></td> </tr></table> <br/> <div align="center"> <input id="submit-btn-contact" type="submit" value="Send Now"> </div> </form> validate.js Link to comment Share on other sites More sharing options...
dsonesuk Posted April 24, 2018 Share Posted April 24, 2018 Big problem is, there is no JavaScript validation code apparently for validating to take place. Link to comment Share on other sites More sharing options...
KateMacwil Posted April 24, 2018 Author Share Posted April 24, 2018 Hi I have attached the validate.js file Link to comment Share on other sites More sharing options...
justsomeguy Posted April 24, 2018 Share Posted April 24, 2018 What happens when you run that, what exactly is the problem? Link to comment Share on other sites More sharing options...
davej Posted April 24, 2018 Share Posted April 24, 2018 The Javascript thinks that name, email, and phone are the names of variables. Link to comment Share on other sites More sharing options...
KateMacwil Posted April 24, 2018 Author Share Posted April 24, 2018 I fixed it - thanks for the help. 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