How to submit a form with a HTTP GET?

How to submit a form with a HTTP GET?

  
Hi,

How can a form be submitted with a method GET instead of POST?

I'm looking to have search results done with GET in order to be able to create direct links to individual page.

For reference, see http://www.w3.org/TR/html4/interact/forms.html#h-17.3

Hi Jose,

You can set the Method property in the Link widget:

- Method = Submit: POST
- Method = Link: GET

You can also check this help topic:

http://www.outsystems.com/help/servicestudio/4.1/Default.htm#miscellaneous/behavior_of_the_link_widget.htm

Cheers,
Paulo Ramos
Hi Paulo,

The documentation states that "Link method: In this case, the inputs in the screen are not posted back to the server."

I'm asking for a way to submit a form with an html button (so that a crawler will not follow the action of the button, as would happen with a a href link) and the submit must be done with a HTTP GET request instead of a HTTP POST.

As an example, one can look at the google home page (http://www.google.com) and the search button, that submits the form with a http GET.

Hi José,

I did not clearly understand you question. Which of the following do you want:
1. To be able to access a Service Studio page by writing the complete URL with the input parameters in the query string?
2. To be able to submit a form in an Outsystems application and afterwards copy the URL from your browser so that you can use it later or pass it to someone else?

Regardless of which of the above, you must take into account that using the Service Studio built in links and buttons, web forms are always submitted with the HTTP POST method. As you said, if you set the "mehod" property of a Service Studio link to "link", the data will not be posted back to the server (which is not a solution).

To solve the problem 1, you can simply create a Service Studio entry point to you Query Web Page. To access your page you'll have to invoke the query URL in your browser: http://<server>/<espace>/<entry_point>.aspx?param1=val1&param2=val2...

To solve problem 2, you can again create a Service Studio entry point to you Query Web Page. Place a button in your application that redirects your application to a Service Studio External Site node with the query URL built dinamically: http://<server>/<espace>/<entry_point>.aspx?param1=val1&param2=val2... Attached I send you an eSpace with a sample of how to do it (you'll have to install SS 4.1 to see it).

Please bear in mind that this solution will only work if the person accessing the URL has the necessary permissions to see it and that it only applies to situation in which you want to pass parameters of simple data types (not records or record lists).

Best Regards,

Daniel Lourenço
Hi Venceslau,

sorry for the late answer. Currently the platform only submits form data using POST requests in web interfaces (mobile screens have different behaviors). If you really need the form inputs in a GET request you have to specify the onclick behavior for your link in the extended properties and create the destination url with the relevant input values. Don't forget to url escape your parameters.

If you need more help, leave another message with the screen that contains the form and specify the destination url, and I'll code a small prototype.
Cheers,
Lúcio
Hi Lucio (and others),

Resuming an old thread to try to go for the Longest_Living_Thread record :)

I do feel that that solution is not what we are looking for, in the sense that we want to have a regular form, with a regular form submit button, that submits with HTTP GET instead of HTTP POST (as the platform currently does).

Using a link is a deal breaker for us because it breaks the UI expectation of end users and links are crawled by spiders and robots.

Also, having to code the specific input values on the destination page _or_ having an intermediate page that receives the POST and then automatically redirects with a GET with the parameters on the URL to a given destination page is just to much work and is easily broken by changes on the search form.

We've tried to change the submission method by altering the DOM with javascript without success (it bombs with a "Specified cast is not valid").

So, recapitulating, what I'm looking is for maintain the "built to change" benefits of the platform by using forms and its easy parameter passing on form submission to another page, but having that form submission done with GET instead of POST.

In a future release, maybe? :)
Welcome back Venceslau,

If you really need such a change in the OutSystems Platform, I suggest you use the OutSystems support channels to discuss it because such a change is not in our current backlog.
Greetings,
Lúcio
Hi Lucio,
I'll do that. Just wanted to make sure there was no easy way out of this :)
-- Regards,
Jose