showModelessDialog problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frozedog
    New Member
    • Dec 2007
    • 3

    showModelessDialog problem

    Just discovered the showModelessDia log feature.

    Here is my problem.

    I Created a link on page 1 that opens modeless popup password window.


    [HTML]<A onClick="window .showModelessDi alog('smPasswor d.asp','ScrollD ata','status:fa lse;dialogWidth :400px;dialogHe ight:200px')">
    <U>My Password</U>
    </a>
    [/HTML]
    Works Great !

    From that Password page ('smPassword.as p'), I enter the password, verify it is valid and then open another page for data entry.

    [CODE=html] <Div align="center">

    <h3>Enter Password</h3>
    <form method="Post" ACTION="">
    <input type="password" name="pwd" value=""><br><b r>
    <input type="submit" value="Enter Password" onClick="checkp wd(this.form)">
    </form>
    </Div>[/code]

    [code=javascript]function checkpwd(form)

    {
    var pwd;
    pwd=form.pwd.va lue;

    if (pwd == "Password")
    {
    window.open("<% =strServerName% >/Path1/Path2/BlahBlahBlah.as p", "windowname ", "height=500 , width=1015, left=1, top =1, resizable=yes, dependent=yes, scrollbars=yes" );
    window.close(); 'This closes the dialog window confirmed it works correctly
    <%
    Session("logino kay") = True
    %>
    }

    else
    {
    alert("Incorrec t Password - Please Try Again !");
    }
    }
    [/CODE]
    Works GREAT except.....

    the BlahBlahBlah.as p window opens and then....

    the 'smPassword.asp ' window re-opens (remember we closed it and verified it in the code), on top of BlahBlahBlah.as p and NOT in the modeless view.

    I have to close it and the BlahBlahBlah.as p page is there good to go.

    One last thing, If I call a Non Existant window in the window.open(<%s trServerName%> code the Page Cannot Be Found window opens AND so does the smPassword window in NON dialog mode. I have checked code in all affected pages and there is absolutley no other reference to smPassword.asp.

    Very Weird.


    Question: What is causing the 'smPassword.asp ' window to open again.

    --------------------------------------------------------------------------------
    frozedog
    Last edited by acoder; Dec 22 '07, 09:26 AM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You're pressing the submit button and not preventing the submit. It submits to itself. In checkpwd, return false at the end to prevent the submit.

    PS. you should never check passwords using client-side code.

    Comment

    • frozedog
      New Member
      • Dec 2007
      • 3

      #3
      Thanks for your response. Of course you were correct. I am very new at JavaScript and would like to pick your brain as to how you suggest to verify passwords.

      Thanks again for your help

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Check on the server-side so that the user can't view the source and see the password in all its glory.

        Comment

        Working...