I currently have a form named "survey". I found here a JavaScript to validate my form. I apologize in advance if there is (and I know there must be) another post asking a similar question. and a JavaScript to set the form action and submit it when done here.
I am having serious issues with this script, either it won't execute at all (the form doesn't work, as well as the validation) or the form submits without validating the form.
Here is the current JavaScript I am using.
In the head section
Code:
<script language="JavaScript">
function checkform()
{
if (!document.survey.look_feel[0].checked &&
!document.feedback.look_feel[1].checked &&
!document.feedback.look_feel[2].checked &&
!document.feedback.look_feel[3].checked &&
!document.feedback.look_feel[4].checked &&)
{
// something is wrong
alert('There is a problem with the first field');
return false;
}
else if (!document.survey.Registration[0].checked &&
!document.feedback.look_Registration[1].checked &&
!document.feedback.look_Registration[2].checked &&
!document.feedback.look_Registration[3].checked &&
!document.feedback.look_Registration[4].checked &&)
{
// something else is wrong
alert('There is a problem with...');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
else
{
document.survey.action = "http://www.fatcow.com/scripts/formemail.bml";
document.survey.submit();
}
</script>
<script language="JavaScript">
function checkform()
{
if (!document.survey.look_feel[0].checked &&
!document.feedback.look_feel[1].checked &&
!document.feedback.look_feel[2].checked &&
!document.feedback.look_feel[3].checked &&
!document.feedback.look_feel[4].checked)
{
// something is wrong
alert('There is a problem with the first field');
return false;
}
else if (!document.survey.Registration[0].checked &&
!document.feedback.look_Registration[1].checked &&
!document.feedback.look_Registration[2].checked &&
!document.feedback.look_Registration[3].checked &&
!document.feedback.look_Registration[4].checked)
{
// something else is wrong
alert('There is a problem with...');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
return true;
}
}
</script>
<script language="JavaScript">
function checkform()
{
if (!document.survey.look_feel[0].checked &&
!document.feedback.look_feel[1].checked &&
!document.feedback.look_feel[2].checked &&
!document.feedback.look_feel[3].checked &&
!document.feedback.look_feel[4].checked)
{
// something is wrong
alert('There is a problem with the first field');
return false;
}
else if (!document.survey.Registration[0].checked &&
!document.feedback.look_Registration[1].checked &&
!document.feedback.look_Registration[2].checked &&
!document.feedback.look_Registration[3].checked &&
!document.feedback.look_Registration[4].checked)
{
// something else is wrong
alert('There is a problem with...');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
return true;
}
}
</script>
eager to release my survey, I got desperate. I quickly googled
"Validate Form Scripts"
Finding bunches of $700 software (that I didn't want) I changed my search to:
"FREE Validate Form Scripts"
Unfortunately, I came up with similar results. So... I searched for software. Remembering my first search results I typed:
"FREE Validate Form Script Software"
Nope... That didn't work either. Then I remembered when I first started learning HTML, when I wanted the image roll-over effect, I would go and find an HTML image roll-over generator. A thought strikes me...
"Validation FREE Javascript Form", I type (in no specific order). I found what I needed. A fantastic service. Only one downside: You can only have 25 form fields. Luckily, I only had 12.
So... for anyone who is looking for a solution, perhaps on google, and happened to stop by the forums:
Bookmarks