Password dialog box

pvarpvar Member Posts: 157
edited 2007-02-19 in Navision Attain
Is there a way I can accept a password through a dialog box but not displaying what the user type(* instead), something similar to PasswordText property of a textbox on a form? Thanks.

Comments

  • Alex_ChowAlex_Chow Member Posts: 5,063
  • pvarpvar Member Posts: 157
    I don't have a textbox, the password is inputed to a variable of the dialog like below.

    gdlgWindow.INPUT(1,gtxtPassword);
  • ara3nara3n Member Posts: 9,256
    I would not use the window Dialog. The dialog is a very limited variable in Navision.
    It is better to create a form.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • pvarpvar Member Posts: 157
    I tried using a form first but I couldn't get the return action from the form properly and that is when I turned to dialog.

    I need to achieve the following.

    1. Continue the processing if the user input the correct password.
    2. Abort the processing if the user Escaped or hit Cancel on the password form

    How do I know if the user did one of the above from the calling function? Thanks for any help.
  • andreofandreof Member Posts: 133
    something like

    variables:
    gfrmFormPassword type form

    gfrmFormPassword.LookUp(TRUE);

    IF gfrmFormPassword.RUNMODAL = ACTION::LookupOK THEN
    password := gfrmFormPassword.FunctionToReturnPassword
    ELSE IF gfrmFormPassword.RUNMODAL = ACTION::LookupCANCEL THEN
    ........
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • pvarpvar Member Posts: 157
    Somehow this doesn't work. The control is not coming to the THEN part when the user type in the correct password. But if I change the ACTION to CLOSE it comes there, then the problem is it always comes to the THEN part( Even when the user hit Esc or click Cancel on the password form)
  • andreofandreof Member Posts: 133
    The user has to click ok after inserting password
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • pvarpvar Member Posts: 157
    Still doesn't work. This is the code in the calling function

    gfrmPassword.LOOKUPMODE(TRUE);

    IF gfrmPassword.RUNMODAL = ACTION::LOOKUPOK THEN
    ChangeSubMenu(50242);

    CLEAR(gfrmPassword);

    and this is the code on the Onpush() of the Ok button on the Password form


    IF gtxtPassword = 'IT' THEN
    CurrForm.CLOSE
    ELSE
    MESSAGE('Wrong Password, Try again!');

    The THEN part doesn't execute if the user type in IT as password
  • andreofandreof Member Posts: 133
    To work you cannot add code in the ok button. Try doing the validation after the password form is closed, or in the validate trigger of the password textbox.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • andreofandreof Member Posts: 133
    or, if you prefer like you have now, do something like this:

    VarOption integer

    gfrmPassword.RUNMODAL;
    gfrmPassword.GetValueOption(VarOption)

    IF VarOption = 1 THEN
    ChangeSubMenu(50242);

    CLEAR(gfrmPassword);


    On the password form create a global variable VarOption and function GetValueOption to return the value of VarOption

    GetValueOption(var pVarOption)
    {
    pVarOption := VarOption
    }

    and this is the code on the Onpush() of the Ok button on the Password form


    IF gtxtPassword = 'IT' THEN BEGIN
    VarOption = 1
    CurrForm.CLOSE;
    END ELSE
    MESSAGE('Wrong Password, Try again!');


    Hope this helps
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • pvarpvar Member Posts: 157
    That worked!! Thank you, andreof, so much for your timley responses and the solution. Thanks to Mibuso as well.
Sign In or Register to comment.