Skip to main content
PasGlop
Inspiring
October 1, 2017
Answered

How to set up a default value in execDialog

  • October 1, 2017
  • 3 replies
  • 1001 views

Dear All,

I need to show a default value in the first field of two of the execDialog function.

Is there a way to do this ?

Thanks in advance,

//Sample of what I am looking for :

var dialogTitle = "Please confirm";

var defaultAnswer = "No.";

var reply = app.response("Did you really mean to type that?", dialogTitle, defaultAnswer);

//Script I need to modify for showing a variable in the first field :

var dialogmdp = {
initialize: function (dialog) {
// Showing the date.
var todayDate = dialog.store()["date"];
todayDate = "Date: " + util.printd("dd mmmm, yyyy", new Date());
dialog.load({ "date": todayDate });
},
commit:function (dialog) {
var results = dialog.store();
},
description:
{
name: "Password generator", // Dialog box title
align_children: "align_left",
width: 350,
height: 200,
elements:
[
{
type: "cluster",
name: "''ctrl+c'' this password and ''ctrl+v'' it in the second field for verifying if they are similar ",
align_children: "align_left",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{

/*******************************************************where I need to fill in the field with a variable as default value******************************************/
type: "static_text",
name: "Generated password to copy  : "
},
{
item_id: "fnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "past it to verify if it has been stored in the clipboard: "
},
{
item_id: "lnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "static_text",
name: "Date: ",
char_width: 25,
item_id: "date"
},
]
},
{
alignment: "align_right",
type: "ok",
ok_name: "OK"
}
]
}
};
app.execDialog(dialogmdp);

This topic has been closed for replies.
Correct answer try67

- Why are you using the store function? The field has no value in this point, so that doesn't make sense.

- Why are you not using the correct item_id of the field in question?

Use this:

mdp2 = "Name: AAAAAAAAA";

dialog.load({ "fnam": mdp2 });

3 replies

PasGlop
PasGlopAuthor
Inspiring
October 1, 2017

Many thanks : I still need a few months of learning ...   :-)

PasGlop
PasGlopAuthor
Inspiring
October 1, 2017

I tried again : it seems working for a string into the dialog box (the date), but not for a field.

Is that right ?

var dialogmdp = {
initialize: function (dialog) {
// Showing the date.
//var todayDate = dialog.store()["date"];
//todayDate = "Date: " + util.printd("dd mmmm, yyyy", new Date());
//dialog.load({ "date": todayDate });

var mdp2 = dialog.store()["name"];
mdp2 = "Name: " + "AAAAAAAAA";
dialog.load({ "name": mdp2 });

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 1, 2017

- Why are you using the store function? The field has no value in this point, so that doesn't make sense.

- Why are you not using the correct item_id of the field in question?

Use this:

mdp2 = "Name: AAAAAAAAA";

dialog.load({ "fnam": mdp2 });

try67
Community Expert
Community Expert
October 1, 2017

You're already doing it with the date field... You need to set the default

value in the dialog's initialize event.

On Sun, Oct 1, 2017 at 7:31 PM, pierrep52392313 <forums_noreply@adobe.com>

PasGlop
PasGlopAuthor
Inspiring
October 1, 2017

I already tried (to modify a downloaded script), but without success...