For redirect you need: form.getElement().<FormElement> cast().setTarget("");
On Thursday, March 22, 2018 at 7:26:54 AM UTC-7, Matthew McLarty wrote:
>
> Okay, for the record, this does not redirect the current page to the URL
> that is set to the action of the FormPanel. Any idea what I'm doing wrong?
>
> FormPanel form = new FormPanel();
> form.setAction("
> https://www.FAKEDOMAIN.com/my-account/order-complete.html");
> form.setHeight("1px");
> form.setWidth("1px");
> form.addStyleName(AppController.HIDDEN_CLASS);
>
> Hidden transactionId = new Hidden();
> transactionId.getElement().setAttribute("name",
> "transactionId");
> transactionId.setValue(order.getOrder().getQuoteNumber());
>
> Hidden transactionTotal = new Hidden();
> transactionTotal.getElement().setAttribute("name",
> "transactionTotal");
> transactionTotal.setValue(order.getTotalAmount().toString
> ());
>
> Hidden printURL = new Hidden();
> printURL.getElement().setAttribute("name", "printURL");
> printURL.setValue(order.getPrintURL());
>
> FlowPanel formStuffer = new FlowPanel();
> formStuffer.add(transactionId);
> formStuffer.add(transactionTotal);
> formStuffer.add(printURL);
>
> form.add(formStuffer);
> view.getPnlTrackingSubmitter().add(form);
> form.submit();
>
>
>
> On Wednesday, March 21, 2018 at 4:19:39 PM UTC-4, Matthew McLarty wrote:
>>
>> Darn, I was really hoping there'd be an cleaner way but if it works, it
>> works, I guess. Thank you, Slava. :)
>>
>> On Wednesday, March 21, 2018 at 4:16:41 PM UTC-4, Slava Pankov wrote:
>>>
>>> You can have hidden (display: none) FormPanel with method="post". Then:
>>> form.getElement().<FormElement> cast().setTarget("");
>>> form.setAction(url);
>>> form.submit();
>>>
>>> That will redirect to specified url with POST.
>>>
>>> On Wednesday, March 21, 2018 at 11:48:46 AM UTC-7, Matthew McLarty wrote:
>>>>
>>>> I feel a little silly asking this since it feels like something that
>>>> should be obvious.
>>>>
>>>> How do I submit data to another URL, via POST (or GET if need be)
>>>> without it being an ajax request? Do I need to construct a fake FormPanel
>>>> and make it 1px big to submit the data to a URL? Can I use request builder
>>>> and set the content-type header? The problem is that I need to browser to
>>>> advance to that URL where the submission is processed but the GWT methods
>>>> all seem to expect that to be an asynchronous event.
>>>>
>>>> Please help?
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.