The process of duplicating a web form that uses the POST method in your LiveCode stack is very similar to the process for implementing a GET method form. The only real difference is that the argument string submitted using POST is not displayed in the browser's address field after submitting the form data. That means that you have to look at the HTML source for the page containing the form (using the browser's View Page Source function) and find the name=value
pairs that need to be submitted by the form.
Since the steps for duplicating a POST form are very similar to those for duplicating a GET form, this list will note the main steps only; the details can be found in the instructions for GET forms. As with GET forms, your whole task in your LiveCode stack is to exactly duplicate the arglist from the web site.
Find a web form whose functionality you would like to implement in LiveCode.
Duplicate the form in your LiveCode stack by building the interface with all of the control objects you need.
Open the HTML source code for the page containing the form and find the <form>
tag.
Find the name=value pairs needed for the POST data, as described in the document on Understanding GET and POST Methods in HTML Forms.
Build your arglist from the elements in your stack's form. You should end up with a string something like this: fullname=Janet+Planet&gender=female&color=red
To submit your form data to the host server, use the LiveCode post
command. Post results go into the it
variable:
put urlEncode(fld "fullname") into tName put the hilitedButtonName of group "genderGrp" into tGndr put urlEncode(the label of btn "colorChoice") into tColor put fullname=" & tName & "&gender=" & tGndr & "&color=" & tColor into tArgList post tArgList to URL "http://my.web.site/sampleform.html" put it into tFormResults
As with the GET example, now all that remains is to parse the desired information out of the returned data.