Expand my Community achievements bar.

Set focus to xfa.host.response dialog box

Avatar

Level 2

Hi,

in my form i do have an xfa.host.response dialog password box:


var sPassword = xfa.host.response("Please enter your password:", "Password", "", true);


I'm wondering now if there is no possibilty to directly set the cursor focus into the pop up password box. To work with xfa.host.setFocus(somExpression) seems to be not possible because the dialog box has no somExpression, right?

Any suggestions?

Thanks!

2 Replies

Avatar

Level 10

Hi,

You have more control with the custom dialogs you can generate with the execDialog method.

Try this;

 

function dialog()

{

   var dialogDescriptor =

   {

       description:

       {

           elements: [

               {

                   type: "static_text",

                   name: "Please enter your password:",

               },

               {

                   width: 300,

                   height: 22,

                   type: "edit_text",

                   item_id: "pwrd",

               },

               {

                   type: "ok_cancel",

               }

           ]

       },

       initialize : function(dialog)

       {

           dialog.load({

               "pwrd": dialogObject.pwrd,

           });

       },

       commit : function(dialog)

       {

           var elements = dialog.store();

           dialogObject.pwrd = elements["pwrd"];

       },

   };

   var dialogObject =

   {

       pwrd: "",

       execDialog: function() { return app.execDialog(dialogDescriptor); },

   };

   return dialogObject;

}

var d = dialog();

d.execDialog();

console.println(d.pwrd);

   

Regards

Bruce

Avatar

Level 2

Hi,

I'm currently struggling with the same problem... the following Enter Event code will place the cursor inside the dialog box; however, the password text will no longer be masked.  I'm still looking for a work-around...


//password protected field
xfa.host.beep("1");
var correctPassword = "your password here";
var resp = app.response({cQuestion:"PASSWORD PROTECTED FIELD", cTitle:"Protected Field", bPassword:true[xfa.host.setFocus(this.someExpression)], cLabel:"ENTER PASSWORD:"});

if(resp==null || resp!=correctPassword){
    app.alert({cMsg:"THIS FIELD IS PASSWORD PROTECTED\nAND IS NOW LOCKED AND INACCESSIBLE", nIcon:0, nType:0, cTitle:"Password Failure"});
    xfa.host.setFocus("your field name here");
    }





Good luck,

Stefan