Multiple inputs form in a stamp

Community Beginner ,
Apr 08, 2020

Copy link to clipboard

Copied

Hi.

 

 I am making a Dynamic stamp. I need to collect multiple data inputs from a form, and shows in the fields of the stamp. The code shows a dialog box every input,  which is annoying:

 

this.getField("Name").value = app.response("Name");
this.getField("Corporation").value = app.response("Company");
this.getField("Invoice").value = app.response("Invoice");

 

 I was triying with something like that, but it just gives me one input....

 

var oDlg = {
	strName: "", initialize: function(dialog) { 
	    dialog.load({"usnm":this.strName}); },
        commit: function(dialog) { 
              var data = dialog.store();
              this.strName = data[ "usnm"];},
        description: { name: "Test Dialog", elements: [
        	{ type: "view", elements: [
        		{ name: "Enter your name:", type: "static_text", },
				{ item_id: "usnm", type: "edit_text", char_width: 15 },
				{ type: "ok_cancel", },
			] },
		] }
};

this.getField("Corporation").value= app.response(oDlg);

 


Anyway, not sure if the code is completely correct, but I think the idea is clear.

Thanks!!

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

104

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

Multiple inputs form in a stamp

Community Beginner ,
Apr 08, 2020

Copy link to clipboard

Copied

Hi.

 

 I am making a Dynamic stamp. I need to collect multiple data inputs from a form, and shows in the fields of the stamp. The code shows a dialog box every input,  which is annoying:

 

this.getField("Name").value = app.response("Name");
this.getField("Corporation").value = app.response("Company");
this.getField("Invoice").value = app.response("Invoice");

 

 I was triying with something like that, but it just gives me one input....

 

var oDlg = {
	strName: "", initialize: function(dialog) { 
	    dialog.load({"usnm":this.strName}); },
        commit: function(dialog) { 
              var data = dialog.store();
              this.strName = data[ "usnm"];},
        description: { name: "Test Dialog", elements: [
        	{ type: "view", elements: [
        		{ name: "Enter your name:", type: "static_text", },
				{ item_id: "usnm", type: "edit_text", char_width: 15 },
				{ type: "ok_cancel", },
			] },
		] }
};

this.getField("Corporation").value= app.response(oDlg);

 


Anyway, not sure if the code is completely correct, but I think the idea is clear.

Thanks!!

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

105

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
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

You've got the right idea, but are missing a few bits.

Here are some articles and tools that will be a big help:

https://acrobatusers.com/tutorials/popup_windows_part5/

https://www.pdfscripting.com/public/All_About_PDF_Stamps.cfm

https://www.pdfscripting.com/public/ACRODIALOGS-OVERVIEW.cfm

 

And here's the reference entry you need for displaying the dialog:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_Acro...

 

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...
Apr 08, 2020 1
Community Beginner ,
Apr 08, 2020

Copy link to clipboard

Copied

Oh, thanks a lot!! I found a script that works for me with multiple fields.
I was wondering if I could place many of those fields in same line, or adding some Checkbox next to a text filed (I mean all in the dialog box) instead every field on several lines... my form has many questions.
Every filed on the code is like this, but din't find the property to locate...

type: "view",
	align_children: "align_row",
	elements:
		[
			{
			type: "static_text",
			name: "User *",
			width:70
			},
			{
			item_id: "user",
			type: "edit_text",
			alignment: "align_right",
			width: 200,
			height: 20
			}
		]
	},


Thanks!!

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...
Apr 08, 2020 0
Community Beginner ,
Apr 08, 2020

Copy link to clipboard

Copied

Well, really I could find the solution!!!

 

{

                     type: "view",

                     align_children: "align_row",

                     elements:

                     [

                        {

                           type: "static_text",

                           name: "Number of pets: "

                        },

                        {

                           type: "radio",

                           item_id: "rd01",

                           group_id: "rado",

                           name: "One"

 

                        },

                        {

                           type: "radio",

                           item_id: "rd02",

                           group_id: "rado",

                           name: "Two",

                        },

                        {

                           type: "radio",

                           item_id: "rd03",

                           group_id: "rado",

                           name: "Three or more",

                        }

                     ]

                  }

Thanks just in case!!!

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...
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

Copy link to clipboard

Copied

The "view" and "cluster" elements in combination with "align_children" property are used to arrange fields

 Is it all working? 

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...
Apr 08, 2020 1