Skip to main content
Known Participant
August 24, 2022
Answered

Dialog box action after pressing ok

  • August 24, 2022
  • 1 reply
  • 965 views

Is there a way to have the text added to a text field from a custom dialog box committed immediately, rather than after moving away from that field? Like automatically hitting enter or tabbing to the next field in Tab Order automatically, with no actual input from user other than just clicking the ok button in the dialog?

 

Thanks.

This topic has been closed for replies.
Correct answer Nesa Nurani

Call dialog from 'Mouse Down' action.

1 reply

Nesa Nurani
Community Expert
Community Expert
August 24, 2022

What script do you use and where?

Known Participant
August 24, 2022

Document Level:

 

var dialog1 = {

initialize: function (dialog) {
// Create a static text containing the current date.
var todayDate = dialog.store()["date"];
todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
dialog.load({ "date": todayDate });
},
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
// Now do something with the data collected,
getField("Name").value = results["fnam"] + " " + results["lnam"];
},
description:
{
name: "Name Information", // Dialog box title
align_children: "align_left",
width: 350,
height: 200,
elements:
[
{
type: "cluster",
name: "Your Name",
align_children: "align_left",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "First Name: "
},
{
item_id: "fnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Last Name: "
},
{
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_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}
};

 

called from a text field "Name". I would alsolike to get rid of the Today's date part. Basically this is the sample script from the API. I also have 18 "Day" fields that need this and some other stuff added.

 

Thanks.

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
August 24, 2022

Call dialog from 'Mouse Down' action.