16 Replies Latest reply on Dec 29, 2011 12:14 PM by Bernd Alheit

    how to define hidden field

    sindhuxyz

      Hi,

       

      I have to use submitForm by http, I have some hidden fields and some input fileds. I am facing problem how to define hidden fields with aFields?

       

      Thanks

        • 1. Re: how to define hidden field
          try67 MVP & Adobe Community Professional

          When you submit the form using this method, it doesn't matter if the fields

          are hidden or not. If you specify them to be submitted, their value is sent

          irregardless of their visibility.

          • 2. Re: how to define hidden field
            sindhuxyz Level 1

            Thanks for quick response.

             

            Bascially, I have html form with 2 input fields and 1 hidden fields. I have created same form using Adobe Javascript, I have created text fields for input from user, but how to manage hidden fields?

             

            I tried:

             

            Put hidden field in pdf document as text filed and used below code:

             

            var f = myOdoc.getField("hidden_id");

            var aSubmitFields = new Array( f,"name", "email");

            myOdoc.submitForm({

            cURL: "https://app.getresponse.com/add_contact_webform.html",

            aFields: aSubmitFields,

            cSubmitAs: "HTML"

                });

             

             

            "name", "email" are 2 input fields in Javascript Dialog pop.

             

            It did not work

             

            Any advise?

            • 3. Re: how to define hidden field
              try67 MVP & Adobe Community Professional

              You just need to add the name of the hidden field to your aSubmitFields

              array, instead of the actual field object, like so:

               

              var aSubmitFields = new Array( "hidden_id" , "name", "email");

              • 4. Re: how to define hidden field
                sindhuxyz Level 1

                Strangly, hidden field(in pdf document) is picked but text fields in Dialog popup is not taken, can you please advise me what is problem here?

                • 5. Re: how to define hidden field
                  try67 MVP & Adobe Community Professional

                  Not sure what you mean... Are you talking about a dialog that you defined

                  in the script? If so, that's just a temporary object which can be

                  submitted. But you can assign the values entered into the dialog to fields

                  (hidden or visible) and then submit them like that.

                  • 6. Re: how to define hidden field
                    sindhuxyz Level 1

                    I tried this:

                     

                    var aSubmitFields = new Array;

                    aSubmitFields["webform_id"] = "134688";

                    aSubmitFields["name"] = "mack"; 

                    aSubmitFields["email"] = "mack50@yahoo.com";

                      

                    this.submitForm({cURL: "https://app.getresponse.com/add_contact_webform.html",aFields: aSubmitFields,cSubmitAs: "HTML"     });

                     

                    but it is not working, error is webform_id is missing. Can you please guide me how to use submitForm like this?

                    • 7. Re: how to define hidden field
                      try67 MVP & Adobe Community Professional

                      The aSubmitFields needs to contain just the names of the fields you want to submit. Their values are automatically collected by the script.

                      So it should be:

                      var aSubmitFields = ["webform_id", "name", "email" ];

                      this.submitForm({cURL: "https://app.getresponse.com/add_contact_webform.html",aFields: aSubmitFields,cSubmitAs: "HTML"});

                      • 8. Re: how to define hidden field
                        sindhuxyz Level 1

                        but I cannot mention all fiels like

                         

                        var aSubmitFields = ["webform_id", "name", "email" ];

                         

                        because one field is hidden and I cannot display it thats why cannot use it like above. Please guide me how to handle it? One field is hidden and I can only use below if all fields are visible or input from user

                         

                        var aSubmitFields = ["webform_id", "name", "email" ];

                        • 9. Re: how to define hidden field
                          try67 MVP & Adobe Community Professional

                          As I told you earlier, it doesn't matter if the field is hidden or visible.

                          • 10. Re: how to define hidden field
                            sindhuxyz Level 1

                            but I do not know if it ispossible to define a field which is hidden to user? Please guide me on it

                             

                            Thanks

                            • 11. Re: how to define hidden field
                              try67 MVP & Adobe Community Professional

                              Yes. Right-click it with the Object Select tool, go to Properties, and

                              under Visibility select Hidden.

                              • 12. Re: how to define hidden field
                                sindhuxyz Level 1

                                I kow it but this is all about Javascript, how to to display off lnam text field?

                                 

                                Here is code:

                                 

                                 

                                var dialog1 = {

                                 

                                   

                                 

                                        initialize: function (dialog) {

                                 

                                            // Create a static text containing the current date.

                                 

                                            var todayDate = dialog.store()["date"];

                                 

                                            todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());

                                 

                                            dialog.load({ "date": todayDate });

                                 

                                        },

                                 

                                        commit:function (dialog) { // called when OK pressed

                                 

                                            var results = dialog.store();

                                 

                                            // Now do something with the data collected, for example,

                                 

                                            console.println("Your name is " + results["fnam"]

                                 

                                                + " " + results["lnam"] );

                                 

                                        },

                                 

                                        description:

                                 

                                        {

                                 

                                            name: "Personal Data",    // Dialog box title

                                 

                                            align_children: "align_left",

                                 

                                            width: 350,

                                 

                                            height: 200,

                                 

                                            elements:

                                 

                                            [

                                 

                                                {

                                 

                                                    type: "cluster",

                                 

                                                    name: "Your Name",

                                 

                                                    align_children: "align_left",

                                 

                                                    elements:

                                 

                                                    [

                                 

                                                        {

                                 

                                                            type: "view",

                                 

                                                            align_children: "align_row",

                                 

                                                            elements:

                                 

                                                            [

                                 

                                                                {

                                 

                                                                    type: "static_text",

                                 

                                                                    name: "First Name: "

                                 

                                                                },

                                 

                                                                {

                                 

                                                                    item_id: "fnam",

                                 

                                                                    type: "edit_text",

                                 

                                                                    alignment: "align_fill",

                                 

                                                                    width: 300,

                                 

                                                                    height: 20

                                 

                                                                }

                                 

                                                            ]

                                 

                                                        },

                                 

                                                        {

                                 

                                                            type: "view",

                                 

                                                            align_children: "align_row",

                                 

                                                            elements:

                                 

                                                            [

                                 

                                                                {

                                 

                                                                    type: "static_text",

                                 

                                                                    name: "Last Name: "

                                 

                                                                },

                                 

                                                                {

                                 

                                                                    item_id: "lnam",

                                 

                                                                    type: "edit_text",

                                 

                                                                    alignment: "align_fill",

                                 

                                                                    width: 300,

                                 

                                                                    height: 20

                                 

                                                                }

                                 

                                                            ]

                                 

                                                        },

                                 

                                                        {

                                 

                                                            type: "static_text",

                                 

                                                            name: "Date: ",

                                 

                                                            char_width: 25,

                                 

                                                            item_id: "date"

                                 

                                                        },

                                 

                                                    ]

                                 

                                                },

                                 

                                                {

                                 

                                                    alignment: "align_right",

                                 

                                                    type: "ok_cancel",

                                 

                                                    ok_name: "Ok",

                                 

                                                    cancel_name: "Cancel"

                                 

                                                }

                                 

                                            ]

                                 

                                        }

                                 

                                    };

                                 

                                 

                                 

                                    app.execDialog(dialog1);

                                • 13. Re: how to define hidden field
                                  try67 MVP & Adobe Community Professional

                                  Are you talking about fields in a dialog or in a form? What's the point of

                                  having hidden fields in a dialog?

                                  • 14. Re: how to define hidden field
                                    Bernd Alheit Adobe Community Professional & MVP

                                    Bascially, I have html form with 2 input fields and 1 hidden fields. I have created same form using Adobe Javascript, I have created text fields for input from user, but how to manage hidden fields?

                                     

                                    I tried:

                                     

                                    Put hidden field in pdf document as text filed and used below code:

                                     

                                    var f = myOdoc.getField("hidden_id");

                                    var aSubmitFields = new Array( f,"name", "email");

                                    myOdoc.submitForm({

                                    cURL: "https://app.getresponse.com/add_contact_webform.html",

                                    aFields: aSubmitFields,

                                    cSubmitAs: "HTML"

                                        });

                                     

                                     

                                    "name", "email" are 2 input fields in Javascript Dialog pop.

                                     

                                    It did not work

                                     

                                    Any advise?

                                    You can only submit fields of a form, not of dialog.

                                    • 15. Re: how to define hidden field
                                      sindhuxyz Level 1

                                      Is it possible to create submit fields of a form dynamically in Javascript? I am submitting a html form by Adobe Javascript which has hidden fields(predefined values) and input fields(input from user).

                                      • 16. Re: how to define hidden field
                                        Bernd Alheit Adobe Community Professional & MVP

                                        You can't submit a HTML form. You can submit form data in HTML format. For this you defines the form fields in Acrobat and adds a submit button.