What did I do wrong??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • abnrange
    No longer a forum member
    • Feb 2006
    • 346

    What did I do wrong??

    I wanted to have multi passwords with different actions. When I add the 3rd password, nothing happens it does not check the nAttempt. No error.. here is the code, any help would be great. Thanks

    sPassword = Dialog.PasswordInput("My App", "Please Enter Your Password:", MB_ICONQUESTION);
    if sPassword ~="".. sPassword and sPassword ~="CANCEL" then
    if sPassword == "pwd1" then
    Button.SetVisible("Button1", true);
    Button.SetVisible("Button2", true);
    Button.SetVisible("Button3", true);
    Button.SetVisible("Button4", true);
    Button.SetVisible("Button5", true);
    Button.SetVisible("Button6", true);
    Button.SetVisible("Button7", true);
    Image.SetVisible("Image2", true);
    Image.SetVisible("Image3", true);
    Image.SetVisible("Image4", true);
    Image.SetVisible("Image10", true);
    elseif sPassword == "pwd2" then
    Button.SetVisible("Button1", false);
    Button.SetVisible("Button2", false);
    Button.SetVisible("Button3", true);
    Button.SetVisible("Button4", false);
    Button.SetVisible("Button5", false);
    Button.SetVisible("Button6", false);
    Button.SetVisible("Button7", false);
    Image.SetVisible("Image2", false);
    Image.SetVisible("Image3", false);
    Image.SetVisible("Image4", false);
    Image.SetVisible("Image10", false);

    elseif sPassword == "pwd3" then
    Button.SetVisible("Button1", false);
    Button.SetVisible("Button2", true);
    Button.SetVisible("Button3", true);
    Button.SetVisible("Button4", true);
    Button.SetVisible("Button5", false);
    Button.SetVisible("Button6", true);
    Button.SetVisible("Button7", false);
    Image.SetVisible("Image2", false);
    Image.SetVisible("Image3", false);
    Image.SetVisible("Image4", false);
    Image.SetVisible("Image10", false);

    elseif sPassword ~= "pwd1".. sPassword ~= "pwd2" and sPassword ~= "pwd3" then
    nAttempt = nAttempt+1;
    Dialog.Message("Error", "Number of Attempts : "..""..nAttempt.." of 5 allowed", MB_OK, MB_ICONEXCLAMATION);
    if nAttempt == 5 then
    Application.Exit();
    else
    Page.Jump("Agree");
    end
    end
  • holtgrewe
    Indigo Rose Customer
    • Jul 2002
    • 779

    #2
    Code:
    elseif sPassword ~= "pwd1"[COLOR="Red"]..[/COLOR] sPassword ~= "pwd2" and sPassword ~= "pwd3" then
    You have a typo in red - change to 'and'.

    HTH

    Comment

    • abnrange
      No longer a forum member
      • Feb 2006
      • 346

      #3
      Need more help!

      Got the typo, what do I use to seperate the passwords? I tried , ~= and , nothing works. What am I missing. Thanks for the quick reply.

      Comment

      • holtgrewe
        Indigo Rose Customer
        • Jul 2002
        • 779

        #4
        You'll need to change your logic. If the password is correct,the logic will never reach the final else statement to the Page.Jump("Agree")

        I won't embarrass myself by trying to code it. I'm sure you can code better than I can. LOL.

        A quick test may be to place an 'end' after the password tests and start a new 'if' statment where you test the '~='

        end
        if sPassword ~= "pwd1" and sPassword ~= "pwd2" and sPassword ~= "pwd3" then
        nAttempt = nAttempt+1;
        Dialog.Message("Error", "Number of Attempts : "..""..nAttempt.." of 5 allowed", MB_OK, MB_ICONEXCLAMATION);
        if nAttempt == 5 then
        Application.Exit();
        else
        Page.Jump("Agree");
        end
        HTH
        Last edited by holtgrewe; 12-08-2007, 06:32 PM.

        Comment

        • abnrange
          No longer a forum member
          • Feb 2006
          • 346

          #5
          Still not working!

          I see the logic, but can't make it work. Not sure what I 'm doing wrong!? I will keep trying. Thanks for the help...

          Comment

          • Mina
            Forum Member
            • Oct 2005
            • 630

            #6
            Hmm it would be easier if u replace
            Code:
            elseif sPassword ~= "pwd1".. sPassword ~= "pwd2" and sPassword ~= "pwd3" then
            with simply

            Code:
            else

            Comment

            • abnrange
              No longer a forum member
              • Feb 2006
              • 346

              #7
              Thanks

              I knew I was missing something... Thanks for the help!

              Comment

              Working...
              X