Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

What did I do wrong??

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

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

    HTH

    Comment


    • #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


      • #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, 07:32 PM.

        Comment


        • #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


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

            Code:
            else

            Comment


            • #7
              Thanks

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

              Comment

              Working...
              X