Skip to main content
Electric_hope6C12
Inspiring
April 8, 2020
Answered

Multiple inputs form in a stamp

  • April 8, 2020
  • 1 reply
  • 1563 views

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

This topic has been closed for replies.
Correct answer Electric_hope6C12

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

1 reply

Thom Parker
Community Expert
April 8, 2020
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Electric_hope6C12
Inspiring
April 8, 2020

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

Electric_hope6C12
Electric_hope6C12AuthorCorrect answer
Inspiring
April 8, 2020

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