Hi everyone!!!! I have this script below. What I need is to make it "break" and focus on the first text field that is invalid. Right now, it alerts the user to the error of their ways but does not focus on the first incorrectly filled out field - it stops at whatever field is the last to be filled out incorrectly rather than stopping at each incorrectly filled out field in sequence. How can I make it guide the user through the improperly filled out fields and then, when all the fields are filled in correctly, alert("Thank you!!");? Would I use an onblur in the respective text fields? I tried this but it immediately forces the user to correct their mistake rather than waiting until the button is pushed which, in this situation, needs to happen before the form is checked for validity. Any suggestions? Thanks very much.
alert("Please enter a valid name - letters only");
alert("Please enter a valid 7 digit telephone number (xxx-xxxx).");
alert("Please enter a valid city - no less than 3 letters, no more than 9.");
<BR><FONT color=green size=5>Part 5 </FONT><BR>10 marks<BR>
<LI>enter a name (letters only)<input type="text" name="name">
<LI>enter a phone number in ###-#### format<input type="text" name="phone">
<LI>enter a city (no less than 3 letters and no more than 9)<input type="text" name="city">
<LI>after entering data use this <input type=button value=button onClick="checkname(); checkphone(); checkcity()"> to
validate the data
<LI>if ok display message "Thank You"
<LI>if any field(s) are incorrect or not filled in then:
<LI>display an alert stating which is the first incorrect field that
needs to be corrected.
<LI>highlight or place the cursor in the first incorrect field for