PDA

View Full Version : Javascript/HTML problem



blurguava
12 Jan 2010, 11:16 PM
function send_onclick(frmName)
{
var bolSubmit;
bolSubmit = true;

if (frmName.email.value == "")
{
alert("You must enter an email address");
bolSubmit = false;
}


if (bolSubmit == true)
{
frmName.submit(frmName);
}
}
</script>

</head>
<body>
<form name="frmName" method="post" action="validate.asp">

Enter your name in the text box. If nothing is entered, a warning <br />
message will be displayed. Only when you enter something into the <br />
text box will the page be submitted. <br /><br />

Please enter your name : <input type="text" name="email" size="20" /><br />

<input type="button" name="butSent" value="Do it" onclick="return send_onclick(frmName)">

</form>


</body>
</html>
Hi there, I would like to know the purpose of having var bolSubmit in the code above. Also, why is it that "form name" allows my code to work even though there is a warning stating that it is outdated, but when I change it from "form name" to "form id", it does not complain of the warning anymore, but instead my code does not work.

Please advise.