|
-
August 15th, 2001, 11:32 AM
#1
HTML & JavaScript Help
Does any know of a good forum for advanced HMTL & JavaScript help? Maybe someone here could help?
I have a submit button that calls an ASP script, but before the script is executed, I have a javascript that checks the search form for value(s). If there is no data in the search form, I have an alert come up and then I have this: "document.frmSearch.cancelEvent = TRUE"
For some reason, the submit event is not cancelled. I get the alert, but the ASP script is still executed?
Yesterday it worked fine and now it is not working today! Any ideas?
Here is the javascript:
<SCRIPT LANGUAGE="JAVASCRIPT">
function checkForm() {
if (document.frmSearch.acctno.value=='' &&
document.frmSearch.login.value=='' &&
document.frmSearch.interval.value=='' &&
document.frmSearch.site.value=='' &&
document.frmSearch.fname.value=='' &&
document.frmSearch.lname.value=='') {
alert('Please complete at least 1 field in the search form');
document.frmSearch.cancelEvent = true;
}
else {
//'document.frmSearch.submit();
}
}
</SCRIPT>
~goddess
[email protected]
"There are no stupid questions, but there are a lot of inquisitive idiots."
-
August 24th, 2001, 12:35 AM
#2
Re: HTML & JavaScript Help
The condition you are using as shown by the script posted by you on this site uses a single quote (").
As a result the script checks that if the value entered =="
e.g. fname is left blank.
The script checks if(fname==") then cancel else submit.
In this case the if condition is never true & it always moves control to else condition i.e "submit"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|