Highlighted

Dialog box

Explorer ,
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?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);
TOPICS
How to

Views

53

Likes

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

Dialog box

Explorer ,
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?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);
TOPICS
How to

Views

54

Likes

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
Sep 03, 2020 0
Most Valuable Participant ,
Sep 03, 2020

Copy link to clipboard

Copied

Yes, it's possible.

Likes

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
Reply
Loading...
Sep 03, 2020 0
Explorer ,
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);

Likes

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
Reply
Loading...
Sep 03, 2020 0
Most Valuable Participant ,
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?

Likes

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
Reply
Loading...
Sep 03, 2020 0
Explorer ,
Sep 03, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Sep 03, 2020 0
Most Valuable Participant ,
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;

Likes

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
Reply
Loading...
Sep 03, 2020 0
Explorer ,
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)

Likes

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
Reply
Loading...
Sep 03, 2020 0
Most Valuable Participant ,
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);

Likes

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
Reply
Loading...
Sep 03, 2020 0
Marietaa LATEST
Explorer ,
Sep 03, 2020

Copy link to clipboard

Copied

Thats it, thank you so much.

Likes

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
Reply
Loading...
Sep 03, 2020 0