Ash
08-21-2003, 11:23 AM
Hi,
I've got a really simple checkform that checks that a message field is not empty, then asks the user if they want to submit the message from XXXX, where XXXX is defined by the following:
You: <input type="radio" name="author" value="<?=$current_username?>" CHECKED>
Them: <input type="radio" name="author" value="<?=$their_name?>">
Comment: <input type="radio" name="author" value="<?=$current_username?>">
3 radios that change the value of 'author' depending on which is selected.
Here's the validate:
<script language="JavaScript">
function checkform (form) {
if (form.message.value == "") {
alert( "Please enter the communication with the customer." );
form.message.focus();
return false ;
}
else {
var agree=confirm("Are you sure you wish to submit this information from "+form.author.value+"?");
if (agree) return true ;
else return false ;
}
}
</script>
The 'non empty' validation works OK, but the only message I can get out is "Are you sure you wish to submit this information from Undefined?" - not what I had in mind.
I'm sure it's a simple problem, but anyone got any ideas ???
Thanks,
Ash
I've got a really simple checkform that checks that a message field is not empty, then asks the user if they want to submit the message from XXXX, where XXXX is defined by the following:
You: <input type="radio" name="author" value="<?=$current_username?>" CHECKED>
Them: <input type="radio" name="author" value="<?=$their_name?>">
Comment: <input type="radio" name="author" value="<?=$current_username?>">
3 radios that change the value of 'author' depending on which is selected.
Here's the validate:
<script language="JavaScript">
function checkform (form) {
if (form.message.value == "") {
alert( "Please enter the communication with the customer." );
form.message.focus();
return false ;
}
else {
var agree=confirm("Are you sure you wish to submit this information from "+form.author.value+"?");
if (agree) return true ;
else return false ;
}
}
</script>
The 'non empty' validation works OK, but the only message I can get out is "Are you sure you wish to submit this information from Undefined?" - not what I had in mind.
I'm sure it's a simple problem, but anyone got any ideas ???
Thanks,
Ash