K
KathyB
Hi, I've tried everything I can think of. Using the script below, I
thought on submit my ConfirmSave function would run, then if true
returned, would run my form action.
At this point it appears to be skipping the function altogether. I'm
also unable to get the textbox.value since I need to use variable for
the form name and input element name. I'm fairly new to this...please
tell me where I am going astray...Thanks.
HTML element:
<form name="form_test"
action="parent.hidden.location=ValidateSave.aspx" method="post"
onsubmit="return ConfirmSave('form_test','measurement')">
<input type="text" name="measurement" value="{.}"/>
<input type="submit" value="SAVE"/>
</form>
FUNCTION:
function ConfirmSave(frm,input) 'arguments get generated via xsl
'for this example, they are
(form_test,measurement)
{
var formname="" +frm
var test="" +input
var content="" +input.value
//tested var's with alert box, frm and input ok, but not value!
if (document.formname.test.value=="")
{
alert("You are trying to save a blank entry.");
formname.test.focus();
formname.test.select();
return false;
}
else {
confirm("You are about to enter: " +formname.test.value+ " -- are
you sure?");
return false;
}
return true;
}
thought on submit my ConfirmSave function would run, then if true
returned, would run my form action.
At this point it appears to be skipping the function altogether. I'm
also unable to get the textbox.value since I need to use variable for
the form name and input element name. I'm fairly new to this...please
tell me where I am going astray...Thanks.
HTML element:
<form name="form_test"
action="parent.hidden.location=ValidateSave.aspx" method="post"
onsubmit="return ConfirmSave('form_test','measurement')">
<input type="text" name="measurement" value="{.}"/>
<input type="submit" value="SAVE"/>
</form>
FUNCTION:
function ConfirmSave(frm,input) 'arguments get generated via xsl
'for this example, they are
(form_test,measurement)
{
var formname="" +frm
var test="" +input
var content="" +input.value
//tested var's with alert box, frm and input ok, but not value!
if (document.formname.test.value=="")
{
alert("You are trying to save a blank entry.");
formname.test.focus();
formname.test.select();
return false;
}
else {
confirm("You are about to enter: " +formname.test.value+ " -- are
you sure?");
return false;
}
return true;
}