Hi,
I have two
fields. I'm trying to do a form validation, whereby, if a state is
selected, then you can't enter value for the province, but a province and
state can't both be empty. I tried this javascript function, but i'm still
having problems. Please can you help.
I tried this one first
function CheckState(){
if((state==""
&&(state_2==""
alert("Please select either a state or type in the
Province."
;
}
return false;
}
else return true;
}
Then this one
function checkInput() {
if ((state_name == "--None--"
&&(state_2 ==""
alert("Please enter a value!"
;
}
return false;
}
else return true;
}
But nothing happend.
Below is the select and text box i'm trying to validate.Thanks
<SELECT name="payee_state">
<OPTION value="" SELECTED>--None--
<CFOUTPUT query="getstates">
<OPTION value="#state_name#" <CFIF
state_name IS GetPayees.state>
SELECTED</cfif>>#state_name#
</CFOUTPUT>
</SELECT>
or Type
<INPUT type="Text" NAME="State_2" size="18" maxlength="60" >
I have two
fields. I'm trying to do a form validation, whereby, if a state is
selected, then you can't enter value for the province, but a province and
state can't both be empty. I tried this javascript function, but i'm still
having problems. Please can you help.
I tried this one first
function CheckState(){
if((state==""
alert("Please select either a state or type in the
Province."
}
return false;
}
else return true;
}
Then this one
function checkInput() {
if ((state_name == "--None--"
alert("Please enter a value!"
}
return false;
}
else return true;
}
But nothing happend.
Below is the select and text box i'm trying to validate.Thanks
<SELECT name="payee_state">
<OPTION value="" SELECTED>--None--
<CFOUTPUT query="getstates">
<OPTION value="#state_name#" <CFIF
state_name IS GetPayees.state>
SELECTED</cfif>>#state_name#
</CFOUTPUT>
</SELECT>
or Type
<INPUT type="Text" NAME="State_2" size="18" maxlength="60" >