Copy link to clipboard
Copied
Is it possible to add button to dialog box when clicked it will add value to text field, and can be used repeatedly whitout closing dialog box?
Ah, got it... Try this:
var dlg = {
commit: function(dialog)
{
var data = dialog.store();
this.strName = data["usnm"];
},
butn: function(dialog){
this.parentDoc.getField("Text1").value = Number(this.parentDoc.getField("Text1").value)+1;
},
description: { name: "", elements: [
{ type: "cluster", align_children: "align_row", elements: [
{ item_id: "usnm", type: "edit_text", char_width: 10,},
{ type: "ok",ok_name: "Yes",},
{type: "button",item_id: "butn",name: "Add Value"}
]},
]}
};
dlg.parentDo
...
Copy link to clipboard
Copied
Yes, it's possible.
Copy link to clipboard
Copied
Thanks Try67 for helping as always. How would I add that funcionality to "butn" in this code?
var dlg = {
commit: function(dialog)
{
var data = dialog.store();
this.strName = data["usnm"];
},
butn: function(dialog){
dialog.end("butn");
},
description: { name: "", elements: [
{ type: "cluster", align_children: "align_row", elements: [
{ item_id: "usnm", type: "edit_text", char_width: 10,},
{ type: "ok",ok_name: "Yes",},
{type: "button",item_id: "butn",name: "Add Value"}
]},
]}
};
app.execDialog(dlg);
Copy link to clipboard
Copied
Wait, do you want the button to increment the value of the text field in the dialog itself ("usnm") or a text field in the document? And by how much?
Copy link to clipboard
Copied
I want it to increase text field in document by 1.
Copy link to clipboard
Copied
Ah, that has nothing to do with the dialog, then... Use this:
if (app.execDialog(dlg)=="ok") this.getField("Text").value = Number(this.getField("Text").value)+1;
Copy link to clipboard
Copied
Thats not it. When I open dialog I want button in this case butn named "Add value" when clicked it add 1 to text field in document and not to close dialog so I can use it multiple times whitout closing dialog. ( button is in dialog itself)
Copy link to clipboard
Copied
Ah, got it... Try this:
var dlg = {
commit: function(dialog)
{
var data = dialog.store();
this.strName = data["usnm"];
},
butn: function(dialog){
this.parentDoc.getField("Text1").value = Number(this.parentDoc.getField("Text1").value)+1;
},
description: { name: "", elements: [
{ type: "cluster", align_children: "align_row", elements: [
{ item_id: "usnm", type: "edit_text", char_width: 10,},
{ type: "ok",ok_name: "Yes",},
{type: "button",item_id: "butn",name: "Add Value"}
]},
]}
};
dlg.parentDoc = this;
app.execDialog(dlg);
Copy link to clipboard
Copied
Thats it, thank you so much.