mikemackay
Programmer
Can anyone help with this?
I have an image on an asp page which, on the 'onclick' event validates a text field (Password). After successfully validating the field, I want a particular layer to 'show' and the others to 'hide'. I am trying to do this without submitting the form
The problem is that the form validates OK but the 'MM_showHideLayers' does not work. If I leave out the 'return document.MM_returnValue;' the form validates by showing the alert, but then goes on to 'show' or 'hide' layers regardless.
Can I achieve form validation which stops the 'MM_showHideLayers' working if the validation picks up the textfield hasn't been completed properly and lets 'MM_showHideLayers' work if the textfield is completed properly, without submitting the form.
Help would be appreciated.
Code is below:
onClick="check_screen();return document.MM_returnValue;MM_showHideLayers('layer_reg_5','','hide','layer_reg_4','','hide','layer_reg_3','','hide','layer_reg_2','','show','layer_reg_1','','hide')" >
function check_screen(){
if (document.form1.Password.value == ""
{
alert("Please enter your password."
return false;
}
else return true;
}
I have an image on an asp page which, on the 'onclick' event validates a text field (Password). After successfully validating the field, I want a particular layer to 'show' and the others to 'hide'. I am trying to do this without submitting the form
The problem is that the form validates OK but the 'MM_showHideLayers' does not work. If I leave out the 'return document.MM_returnValue;' the form validates by showing the alert, but then goes on to 'show' or 'hide' layers regardless.
Can I achieve form validation which stops the 'MM_showHideLayers' working if the validation picks up the textfield hasn't been completed properly and lets 'MM_showHideLayers' work if the textfield is completed properly, without submitting the form.
Help would be appreciated.
Code is below:
onClick="check_screen();return document.MM_returnValue;MM_showHideLayers('layer_reg_5','','hide','layer_reg_4','','hide','layer_reg_3','','hide','layer_reg_2','','show','layer_reg_1','','hide')" >
function check_screen(){
if (document.form1.Password.value == ""
{
alert("Please enter your password."
return false;
}
else return true;
}