Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

HTTP Submit Button

Avatar

Former Community Member
Hi all



I am a newbie here and I have a question about Forms relating to the HTTP Submit Button. I would like some advice if possible please or really if anyone has any examples of forms they have where they have a submit button that sends the data contained in their form to a Webpage. I have created a simple form that will evetually makeup an application form and I want to give our users the the access to just hit the submit button and for that data from the form to be submitted to one of our webpages. What coding do I need for this. Our pages are coded with ASP and Javascript. I am not the most experienced Javascript coder but do code it.



Any help would be much appreciated.



Many Thanks



Rob
11 Replies

Avatar

Level 4
Rob,

I haven't tested this myself, but I'm pretty sure that the HTTP submit button does an HTTP Post and organizes the data in exactly the same way a submit from an HTML form. There will probably be some funniness with the names because of the hierarchical nature of the the XFA forms. If you already have a server and ASP pages set up, this should not be hard to test.



Thom Parker

WindJack Solutions


www.windjack.com

Avatar

Former Community Member
Hi Thom



Thanks for the help thats great. You dont have a link to any info on HTTP Post do you please?



Many Thanks



Rob

Avatar

Level 7
That's the same thing an HTML form does, so you should be able to

build on existing ASP knowledge.



Aandi Inston

Avatar

Former Community Member
Hi



Thom and Aandi thats great, thanks for your help



Regards



Rob

Avatar

Former Community Member
Boy I must be thick but I can't figure it out based on the info above. Can you direct me a little more?



The user fills a field on a form - the Objects Name (under the Object / Binding / Name:) is txtName. I have a submit button with type of Button and the Object / Submit / Submit Format: is URL-encoded Data (HTTP Post) and the Submit to URL: is pdfMembershipFees.cfm



Within the pdfMembershipFees.cfm HTML page I was to access the value that the user typed in the txtName field. How do I do that? Is there a simple example of the pdf form and a HTML page (I would prefer a Coldfusion (cfm) page) that work together and just display the value on the screen from the HTML page.



This is pretty urgent so thanks for answering promptly.

Avatar

Level 4
I'm not a Coldfusion user so I can't give you a specific answer. But, if you were submitting from an HTML page instead of a PDF, How would you get data value? It should be the same process.



Thom Parker

WindJack Solutions


www.windjack.com

Avatar

Former Community Member
Normally it would be #FieldName# and using my example above it would be #txtName# but the CF page doesn't see that field name.

Avatar

Level 4
I don't know what submission format ColdFusion expects, I would assume that it would be one of the standard HTTP Requests, either POST or GET. You might want to find this out.



I'm not sure about the options on the HTTP submit button in Designer. But I'm sure you can change this part of the submission format.



Also, there is an input parameter for the Acrobat JavaScript "submitForm()" function that sets the PUT or GET format. You might consider using this function from a normal button instead of whatever is build into HTTP Submit button.



Thom Parker

WindJack Solutions


www.windjack.com

Avatar

Former Community Member
something like this should work:<br /><cfset order_id = '#form["F[0].P1[0].Order_ID[0]"]#'><br /><br />I think the quote style is important (single quotes around the outside, double quotes around the fully qualified field name.<br /><br />top-level object in my PDF is named "F"<br />next level object is "P1"<br />field name is "Order_ID"<br />(to view the hierarchy in LiveCycle - window menu -> hierarchy)<br /><br />The other thing that caused me grief was that all the form data "evaporates" after first call to the processing page...so you only get one chance to process. hitting refresh on the processing page will give you an error about not finding the field.

Avatar

Former Community Member
<!--- <br />I'm late to this discussion, but in case anyone needs this code, I'm doing my good deed for the day. Allen Levine kindly send me the code to post Livecycle data via CF, and so I am sending it on to you. I also do some REPlaces in my CF code to configure my lists into saveable strings:<br /><br />Livecycle Designer:<br />Insert a button object for the submit button.<br />Button Properties:<br />In field tab, Control Type=Submit<br />Submit tab, place your url for the following code.<br />Submit As= XML Data (XML)<br /><br />Here's the CF code to process the submit, which sends it to strings:<br /><br />XML capture and looping code courtesy of Allen Levine,<br />allen@oysterweb.com<br /><br />Capture The Actual XML Data To A Variable <br />GetHttpRequestData<br />Description<br />Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header.<br />about tostring -> Value to convert to a string; can be a simple value such as an integer, a binary object, or an XML document object.<br />---><br /><cfparam name="mfieldnames" type="string" default=""><br /><cfparam name="mfieldvalues" type="string" default=""><br /><cfparam name="mFieldNamesCheck" type="string" default=""><br /><cfparam name="tmpFieldNameEval" type="string" default=""><br /><br /><cfset x = GetHttpRequestData()><br /><cfset strXML = '#toString(x.content)#'><br /><cfif 1 eq 2> <br /> This is what the RAW XML packet Looks Like<BR><br /> <cfdump var="#strXML#"><br /> <cfabort><br /></cfif> <br /> <!--- Now We Parse The Actual XML <br /> xmlParse descrip -> Converts XML text into an XML document object.<br /> IsXmlDoc -> Description Determines whether the function parameter is a ColdFusion XML document object.---><br /> <cfset tsUpload = #Now()#><br /> <cfset parsedXML=xmlParse(strXML)><br /> <cfset isXML=isXmlDoc(parsedXML)><br /><br /> <!--- Check For Well Formatted XML Doc ---><br /> <cfif isXML EQ 'Yes'><br /> <!--- Get the root element ---><br /> <cfset theRoot = parsedXML.XmlRoot><br /> <!--- Get The Number Of Children To Use In Loop<br /> xmlChildren -> Using the corresponding structure entry names (that is, XmlChildren array entries), such as mydoc.employee.XmlChildren[1] ---><br /> <cfset num_Children_Root = arrayLen(theRoot.XmlChildren)><br /> <cfelse><br /> Problem. The XML does not appear to be well formatted.<br /> </cfif><br /> <cfoutput> <br /> <cfif 1 eq 1><br /> There Are #num_Children_Root# Children In The XML File.<BR><br /> Looping Through XML Elements: <BR><br /> </cfif><br /> <br /> <br /> <cfset mFieldNamesCheck=""><br /> <cfloop index="x" from="1" to="#num_Children_Root#"><br /> <cfset tmpFieldName = "#theRoot.XMLChildren[x].XmlName#"><br /> <cfset "#tmpFieldName#" = "#theRoot.XMLChildren[x].XmlText#"><br /> <cfset #tmpFieldNameEval# = "#evaluate(tmpFieldName)#"><br /> <br /><!-- Below is where the ordered pairs are turned into two lists. One list is column headers, the other list is column values.--> <br /><cfif 1 eq 1><br /> <cfif #tmpFieldNameEval# neq "" and #tmpFieldNameEval# neq 0><br /> <cfset mFieldNames=listappend(mFieldNames, #tmpFieldName#)><br /> <!--comma replacer here--changes , to | --><br /> <cfset tmpFieldNameEval=#Replace(tmpFieldNameEval, ",", "|", "all")#><br /> <!--apostrophe replacer here changes ' to @@", "all")#> <br /> <cfif not (#IsDate(tmpFieldNameEval)#)><br /> <cfset tmpFieldNameEval="'"&#tmpFieldNameEval#&"'"> <br /> </cfif> <br /> <cfif not (#Isnumeric(tmpFieldNameEval)#) and #IsDate(tmpFieldNameEval)#><br /> <cfset tmpFieldNameEval="#CreateODBCDate(tmpFieldNameEval)#"> <br /> </cfif> <br /> <cfset mFieldValues=listappend(mFieldValues, #tmpFieldNameEval#)><br /> </cfif> <!--only store information where fields are completed--><br /></cfif><br /><br /><cfif 1 eq 1><br /> <cfif 1 eq 1><br /> <cfset varCheckFieldNames = ListContainsNoCase(mFieldNamesCheck, "'"&tmpFieldName&"'")> <br /> <CFIF #varCheckFieldNames# is 0> <br /> <cfset mFieldNamesCheck=#listappend(mFieldNamesCheck, "'"&tmpFieldName&"'")#><br /> </CFIF> <br /> <cfoutput><br /> tmpFieldNameEval=#tmpFieldName#<br /><br /> varCheckFieldNames=#varCheckFieldNames#<br /><br /> mFieldNamesCheck=#mFieldNamesCheck#<br /><br /> </cfoutput> <br /> <cfif #varCheckFieldNames# neq 0><br /> <cfoutput><br /> mFieldNamesCheck=#mFieldNamesCheck#<br /><br /> I couldn't find in mFieldNamesCheck #tmpFieldName#<br /><br /><br /> </cfoutput> <br /> <cfset mFieldNames=listappend(mFieldNames, #tmpFieldName#)><br /> <!--comma replacer here--changes , to | --><br /> <cfset tmpFieldNameEval=#Replace(tmpFieldNameEval, ",", "|", "all")#><br /> <!--apostrophe replacer here changes ' to @@", "all")#> <br /> <cfif not (#IsDate(tmpFieldNameEval)#)><br /> <cfset tmpFieldNameEval="'"&#tmpFieldNameEval#&"'"> <br /> </cfif> <br /> <cfif not (#Isnumeric(tmpFieldNameEval)#) and #IsDate(tmpFieldNameEval)#><br /> <cfset tmpFieldNameEval="#CreateODBCDate(tmpFieldNameEval)#"> <br /> </cfif> <br /> <cfset mFieldValues=listappend(mFieldValues, #tmpFieldNameEval#)><br /> </cfif> <!--only store to mfieldnames and mfieldvalues when not in list mfieldnamesCheck --><br /> </cfif> <!--only store information where fields are completed--> <br /></cfif><br /><cfif 1 eq 1> <br /> <cfoutput><br /> #tmpFieldName#=#tmpFieldNameEval#<br /><br /> </cfoutput> <br /></cfif> <br />/cfloop>

Avatar

Former Community Member
above code also had this note:

Allen Levine kindly send me the answer to this, and so I am sending it on to you. I also do some REPlaces in my CF code to configure my lists into saveable strings:



Livecycle Designed:

Insert a button object for the submit button.

Button Properties:

In field tab, Control Type=Submit

Submit tab, place your url for the following code.

Submit As= XML Data (XML)



XML capture and looping code courtesy of Allen Levine,

allen@oysterweb.com



Capture The Actual XML Data To A Variable

GetHttpRequestData

Description

Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header.

about tostring -> Value to convert to a string; can be a simple value such as an integer, a binary object, or an XML document object.