• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dialog box

Explorer ,
Sep 03, 2020 Sep 03, 2020

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?

TOPICS
How to

Views

713

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 03, 2020 Sep 03, 2020

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
...

Votes

Translate

Translate
Community Expert ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

Yes, it's possible.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2020 Sep 03, 2020

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

I want it to increase text field in document by 1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2020 Sep 03, 2020

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2020 Sep 03, 2020

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2020 Sep 03, 2020

Copy link to clipboard

Copied

LATEST

Thats it, thank you so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines