bt707
asked on
Perl and html
I have a CGI using perl, I have some html in a section I'm trying to update but not getting it to do what I need.
From the code below:
if (document.update.emergency contacts_n ame1_new.v alue == "") is TRUE
then I get a popup box that shows the "Your have not set any emergency contact information"
If I select Cancel then I get my alert popup for the "Hit cancel" with is suppose to do.
The problem I have is I'm trying to set it so that if I select OK from the popup then I set a new value which will print out the popup of "Hit OK" for now so I know it's working.
What am I doing wrong where I do not get the alert of "Hit OK" but I do get the "Hit cancel" if I select cancel so I know it's reading the if (answer) code.
Thanks,
From the code below:
if (document.update.emergency
then I get a popup box that shows the "Your have not set any emergency contact information"
If I select Cancel then I get my alert popup for the "Hit cancel" with is suppose to do.
The problem I have is I'm trying to set it so that if I select OK from the popup then I set a new value which will print out the popup of "Hit OK" for now so I know it's working.
What am I doing wrong where I do not get the alert of "Hit OK" but I do get the "Hit cancel" if I select cancel so I know it's reading the if (answer) code.
Thanks,
if ($user)
{
print << "VALIDATE1";
<script language=javascript>
function validateData() {
if (document.update.emergencycontacts_name1_new.value == "") {
var answer =confirm("Your have not set any emergency contact information")
if (answer) {
document.update.emergencycontacts_declined_new.value="1"
alert("Hit OK");
return true;
} else {
alert("Hit cancel");
return false;
}
}
else {
alert("Your EC is set " + document.update.emergencycontacts_name1_new.value + "!");
return true;
}
}
</script>
VALIDATE1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,