garymgordon
Programmer
I have the two functions (as shown below).
So, my question is ...
What is the best way to have a FORM check both of these before processing the information to a perl script.
Can I have the onSubmit call both of the functions (one after the other) before it submits the information to a perl script ... and if so, ... how?
Or, ...
Can I combine the two together somehow?
Or, ...
Can I have one function ... call the other function (when it reached the end of the first one) ... to kind of link multiple functions together ... one after the other?
I could really use some good advice and help.
Thanks.
Gary
============
CODE:
<script type="text/javascript" language="javascript">
<!--
function validateCheckBoxes(checkboxName, checkboxList) {
var checkboxValue = null;
for (var i=0; i < checkboxList.length; i++) {
if (checkboxList.checked) {
checkboxValue = checkboxList.value;
break;
}
}
if (checkboxValue == null) {
alert("Please be sure to check off a minimum of at least ONE checkbox."
return false;
}
/*
else {
alert("Thanks for selecting our " + checkboxValue + " " + checkboxName + " Netwood Design Center boxer shorts. We will mail them to your grandmother immediately."
return false; // in operation would be "return true"
}
*/
}
//-->
</script>
<script type="text/javascript" language="javascript">
<!--
function checkData()
{
var correct = true;
if (document.Form.first_name.value == "" {correct = false; alert("Please enter your first name in the field titled: 'First Name'"}
if (document.Form.last_name.value == "" {correct = false; alert("Please enter your last name in the field titled: 'Last Name'."}
if (document.Form.email.value == "" {correct = false; alert("Please enter your e-mail address in the field titled: 'E-mail Address'."}
return correct;
}
//-->
</script>
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer
So, my question is ...
What is the best way to have a FORM check both of these before processing the information to a perl script.
Can I have the onSubmit call both of the functions (one after the other) before it submits the information to a perl script ... and if so, ... how?
Or, ...
Can I combine the two together somehow?
Or, ...
Can I have one function ... call the other function (when it reached the end of the first one) ... to kind of link multiple functions together ... one after the other?
I could really use some good advice and help.
Thanks.
Gary
============
CODE:
<script type="text/javascript" language="javascript">
<!--
function validateCheckBoxes(checkboxName, checkboxList) {
var checkboxValue = null;
for (var i=0; i < checkboxList.length; i++) {
if (checkboxList.checked) {
checkboxValue = checkboxList.value;
break;
}
}
if (checkboxValue == null) {
alert("Please be sure to check off a minimum of at least ONE checkbox."
return false;
}
/*
else {
alert("Thanks for selecting our " + checkboxValue + " " + checkboxName + " Netwood Design Center boxer shorts. We will mail them to your grandmother immediately."
return false; // in operation would be "return true"
}
*/
}
//-->
</script>
<script type="text/javascript" language="javascript">
<!--
function checkData()
{
var correct = true;
if (document.Form.first_name.value == "" {correct = false; alert("Please enter your first name in the field titled: 'First Name'"}
if (document.Form.last_name.value == "" {correct = false; alert("Please enter your last name in the field titled: 'Last Name'."}
if (document.Form.email.value == "" {correct = false; alert("Please enter your e-mail address in the field titled: 'E-mail Address'."}
return correct;
}
//-->
</script>
Gary M. Gordon, LLC
webmaster@garymgordon.com
Certified Web Developer ::
Application Programmer