Jump to content

[SOLVED] please help what's wrong here


Panjabel

Recommended Posts

<script language="javascript">
function validate(){
if (document.myform.ss1.value == "") {
alert("empty field");
return false;
}
</script>
<form name="myform" method="post" onsubmit="return validate()">
<input type="text" name="ss1" id="ss1">
<input type="submit" value="submit">
</form>

??? ??? ??? ???

Link to comment
https://forums.phpfreaks.com/topic/125416-solved-please-help-whats-wrong-here/
Share on other sites

Make you're script this:

 

<script language="javascript">
function validate(){
if (document.myform.ss1.value == "") {
alert("empty field");
return false;
}else{
return true;
}
}
</script>

 

You're missing the closing of the if statement, I also added an else and returned true.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.