You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Merrill <ch...@webperformance.com> on 2012/06/12 20:23:57 UTC
POSTing to an iframe
Evidently what I need to do is not a great fit for Wicket, but it is only a small
part of a page in a larger application for which Wicket is a good fit. So I'm
trying to force this requirement to fit...please bear with me :>
I need to load an external site into an iframe within a Wicket page. This
would be really easy, except for:
1. A POST to the URL is required, not a GET
2. The URL is not known until runtime
3. The values of the fields are not known until runtime
I have this mostly hacked-together and working, except that Wicket is
renaming my fields - pre-pending the form name :(
The relevant part of my HTML looks like this:
<form wicket:id="form" action="#" method="post" target="appframe" id="formid">
<input wicket:id="signed_request" type=hidden name="signed_request" value="">
</form>
<iframe name="appframe" width="100%" height="600">
</iframe>
And there is some javascript that executes the post into the iframe in body.onload.
The relevant bit of the page code looks like this:
WebMarkupContainer form = new WebMarkupContainer("form");
form.add(new AttributeModifier("action", url));
add(form);
HiddenField<String> signed_request = new HiddenField<String>("signed_request", _signed_request);
form.add(signed_request);
Everything works, except that the field "signed_request" gets renamed to "form:signed_request".
Any ideas how to get around this? Or perhaps a better approach?
TIA!
Chris
--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
chris@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: POSTing to an iframe
Posted by Chris Merrill <ch...@webperformance.com>.
On 6/12/2012 2:27 PM, Igor Vaynberg wrote:
> override getInputName() on the field and hardcode it to signed_request
That works perfect...I should have figured that out on my own :(
I also realized that I could instantiate field as a WebMarkupContainer
just like I did with the form:
WebMarkupContainer signed_request = new WebMarkupContainer("signed_request");
signed_request.add(new AttributeModifier("value", _signed_request.getObject()));
form.add(signed_request);
Thanks!!!
> -igor
>
> On Tue, Jun 12, 2012 at 11:23 AM, Chris Merrill
> <ch...@webperformance.com> wrote:
>> Evidently what I need to do is not a great fit for Wicket, but it is only a small
>> part of a page in a larger application for which Wicket is a good fit. So I'm
>> trying to force this requirement to fit...please bear with me :>
>>
>> I need to load an external site into an iframe within a Wicket page. This
>> would be really easy, except for:
>> 1. A POST to the URL is required, not a GET
>> 2. The URL is not known until runtime
>> 3. The values of the fields are not known until runtime
>>
>>
>> I have this mostly hacked-together and working, except that Wicket is
>> renaming my fields - pre-pending the form name :(
>>
>>
>> The relevant part of my HTML looks like this:
>>
>> <form wicket:id="form" action="#" method="post" target="appframe" id="formid">
>> <input wicket:id="signed_request" type=hidden name="signed_request" value="">
>> </form>
>>
>> <iframe name="appframe" width="100%" height="600">
>> </iframe>
>>
>> And there is some javascript that executes the post into the iframe in body.onload.
>>
>>
>> The relevant bit of the page code looks like this:
>>
>> WebMarkupContainer form = new WebMarkupContainer("form");
>> form.add(new AttributeModifier("action", url));
>> add(form);
>>
>> HiddenField<String> signed_request = new HiddenField<String>("signed_request", _signed_request);
>> form.add(signed_request);
>>
>> Everything works, except that the field "signed_request" gets renamed to "form:signed_request".
>>
>> Any ideas how to get around this? Or perhaps a better approach?
>>
>>
>> TIA!
>> Chris
>>
>>
>>
>>
>>
>> --
>> ------------------------------------------------------------------------ -
>> Chris Merrill | Web Performance, Inc.
>> chris@webperformance.com | http://webperformance.com
>> 919-433-1762 | 919-845-7601
>>
>> Web Performance: Website Load Testing Software & Services
>> ------------------------------------------------------------------------ -
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
chris@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: POSTing to an iframe
Posted by Igor Vaynberg <ig...@gmail.com>.
override getInputName() on the field and hardcode it to signed_request
-igor
On Tue, Jun 12, 2012 at 11:23 AM, Chris Merrill
<ch...@webperformance.com> wrote:
> Evidently what I need to do is not a great fit for Wicket, but it is only a small
> part of a page in a larger application for which Wicket is a good fit. So I'm
> trying to force this requirement to fit...please bear with me :>
>
> I need to load an external site into an iframe within a Wicket page. This
> would be really easy, except for:
> 1. A POST to the URL is required, not a GET
> 2. The URL is not known until runtime
> 3. The values of the fields are not known until runtime
>
>
> I have this mostly hacked-together and working, except that Wicket is
> renaming my fields - pre-pending the form name :(
>
>
> The relevant part of my HTML looks like this:
>
> <form wicket:id="form" action="#" method="post" target="appframe" id="formid">
> <input wicket:id="signed_request" type=hidden name="signed_request" value="">
> </form>
>
> <iframe name="appframe" width="100%" height="600">
> </iframe>
>
> And there is some javascript that executes the post into the iframe in body.onload.
>
>
> The relevant bit of the page code looks like this:
>
> WebMarkupContainer form = new WebMarkupContainer("form");
> form.add(new AttributeModifier("action", url));
> add(form);
>
> HiddenField<String> signed_request = new HiddenField<String>("signed_request", _signed_request);
> form.add(signed_request);
>
> Everything works, except that the field "signed_request" gets renamed to "form:signed_request".
>
> Any ideas how to get around this? Or perhaps a better approach?
>
>
> TIA!
> Chris
>
>
>
>
>
> --
> ------------------------------------------------------------------------ -
> Chris Merrill | Web Performance, Inc.
> chris@webperformance.com | http://webperformance.com
> 919-433-1762 | 919-845-7601
>
> Web Performance: Website Load Testing Software & Services
> ------------------------------------------------------------------------ -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org