CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    Salt Lake City, UT
    Posts
    135

    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."

  2. #2
    Join Date
    Aug 2001
    Location
    Mumbai, India
    Posts
    0

    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
  •  





Click Here to Expand Forum to Full Width

Featured