mcolton
08-23-2009, 11:29 AM
I have a lot of field checks on a form. If the user doesn't fill in required field and hits submit, he gets an error message popup for EVERY error. If the user didn't answer 9 questions, he gets 9 popups.
What I would like is: If the user doesn't fill in a required field and hits submit, he gets a popup error and focus is given to the field that needs to be input. That makes it a lot easier for the user.
I hope I explained this right. Below is partial code.
<script type="text/javascript">
function validate() {
mNv1=dogadoptionform.xname.value;
mNv2=dogadoptionform.xemail.value;
mNv3=dogadoptionform.xaddress.value;
mNv4=dogadoptionform.xcity.value;
.... lots more....
if (mNv1=='') {
alert('Name is required.');
event.returnValue=false;
}
if (mNv2=='') {
alert('Email is required.');
event.returnValue=false;
}
if (mNv3=='') {
alert('Address is required.');
event.returnValue=false;
}
if (mNv4=='') {
alert('City is required.');
event.returnValue=false;
}
.... lots more.....
</script>
What I would like is: If the user doesn't fill in a required field and hits submit, he gets a popup error and focus is given to the field that needs to be input. That makes it a lot easier for the user.
I hope I explained this right. Below is partial code.
<script type="text/javascript">
function validate() {
mNv1=dogadoptionform.xname.value;
mNv2=dogadoptionform.xemail.value;
mNv3=dogadoptionform.xaddress.value;
mNv4=dogadoptionform.xcity.value;
.... lots more....
if (mNv1=='') {
alert('Name is required.');
event.returnValue=false;
}
if (mNv2=='') {
alert('Email is required.');
event.returnValue=false;
}
if (mNv3=='') {
alert('Address is required.');
event.returnValue=false;
}
if (mNv4=='') {
alert('City is required.');
event.returnValue=false;
}
.... lots more.....
</script>