Hi i have a form below, i have some javascript to validate if the text box is empty.
what i need to do is
if the text box "qtext" is empty show alert
if the text box "qtext" is not empty and the value = 8 then update the value of the form element "answer" to "1"
then submit the form
else set the text box "qtext" to value of "0" and submit the form
**form**
<input type="text" name="qtext" />
<input id="qone" name="Answer" type="HIDDEN"/>
<input type="submit" value="Submit" onclick="return TextType();"
**current javascript**
function TextType()
{
if ((form1.qText.value.length < 1) || (form1.qText.value.length > 1))
{
mesg = "You have not answered the question!\n"
mesg = mesg + "Please select an image"
alert(mesg);
return (false);
}
return (true);
}
what i need to do is
if the text box "qtext" is empty show alert
if the text box "qtext" is not empty and the value = 8 then update the value of the form element "answer" to "1"
then submit the form
else set the text box "qtext" to value of "0" and submit the form
**form**
<input type="text" name="qtext" />
<input id="qone" name="Answer" type="HIDDEN"/>
<input type="submit" value="Submit" onclick="return TextType();"
**current javascript**
function TextType()
{
if ((form1.qText.value.length < 1) || (form1.qText.value.length > 1))
{
mesg = "You have not answered the question!\n"
mesg = mesg + "Please select an image"
alert(mesg);
return (false);
}
return (true);
}