You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ha...@dds.nl on 2013/10/25 10:40:07 UTC

break out inlineframe with form submission

Dear Wicketeers,

I am puzzling how to break out of an inlineFrame ( IFrame ) on an form  
submission. I have an a Form in a InlineFrame. The result of submitted  
this form should be opening a new tab/ page.

The code:

Form form = new Form("form")

....

AjaxSubmitLink submitButton = new AjaxSubmitLink("submitButton", form) {

	@Override
	protected void onSubmit(AjaxRequestTarget target, Form<?> form) {


	getRequestCycle().scheduleRequestHandlerAfterCurrent(new  
RedirectRequestHandler(newUrl));
	}
   }

HTML:

<form wicket:id="form" id="form" method="get" target="_blank">
....
<span class="button link"> <input wicket:id="submitButton" type="submit"/>
</form>


Has anyone dealt with such an issue or has any pointers how to  
approach this issue?

Regards,

Haiko









---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: break out inlineframe with form submission

Posted by Sven Meier <sv...@meiers.net>.
What's your problem?

Sven

On 10/25/2013 10:40 AM, haiko@dds.nl wrote:
> Dear Wicketeers,
>
> I am puzzling how to break out of an inlineFrame ( IFrame ) on an form 
> submission. I have an a Form in a InlineFrame. The result of submitted 
> this form should be opening a new tab/ page.
>
> The code:
>
> Form form = new Form("form")
>
> ....
>
> AjaxSubmitLink submitButton = new AjaxSubmitLink("submitButton", form) {
>
>     @Override
>     protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>
>
>     getRequestCycle().scheduleRequestHandlerAfterCurrent(new 
> RedirectRequestHandler(newUrl));
>     }
>   }
>
> HTML:
>
> <form wicket:id="form" id="form" method="get" target="_blank">
> ....
> <span class="button link"> <input wicket:id="submitButton" 
> type="submit"/>
> </form>
>
>
> Has anyone dealt with such an issue or has any pointers how to 
> approach this issue?
>
> Regards,
>
> Haiko
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: break out inlineframe with form submission

Posted by ha...@dds.nl.
Hi Martin,

Martin Grigorov <mg...@apache.org> schreef:


>> How can I have an Ajax submit with the same behavior as 'target="_blank"'?
>>
>
> The question is: does it need to be Ajax submit at all ? With non-Ajax
> submit the '_blank' will be used and the current page with the iframe won't
> be reloaded.
>
> If you want to be Ajax submit then do something like:
> target.appendJavaScript("window.open('', "+newUrl+")")
>
>

For rendering on errors I need ajax behavior in the InlineFrame, so I  
will try the javascript option. Thanks for your feedback.

Haiko




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: break out inlineframe with form submission

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Oct 25, 2013 at 12:17 PM, <ha...@dds.nl> wrote:

> Hi Martin,
>
> For clarification, the problem is that the result is rendered in the
> inlineFrame ( IFrame ).
>

I can see that.


> How can I have an Ajax submit with the same behavior as 'target="_blank"'?
>

The question is: does it need to be Ajax submit at all ? With non-Ajax
submit the '_blank' will be used and the current page with the iframe won't
be reloaded.

If you want to be Ajax submit then do something like:
target.appendJavaScript("window.open('', "+newUrl+")")


>
>
> Martin Grigorov <mg...@apache.org> schreef:
>
>  Hi,
>>
>>
>> On Fri, Oct 25, 2013 at 11:40 AM, <ha...@dds.nl> wrote:
>>
>>  Dear Wicketeers,
>>>
>>> I am puzzling how to break out of an inlineFrame ( IFrame ) on an form
>>> submission. I have an a Form in a InlineFrame. The result of submitted
>>> this
>>> form should be opening a new tab/ page.
>>>
>>> The code:
>>>
>>> Form form = new Form("form")
>>>
>>> ....
>>>
>>> AjaxSubmitLink submitButton = new AjaxSubmitLink("submitButton", form) {
>>>
>>>         @Override
>>>         protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>>>
>>>
>>>         getRequestCycle().****scheduleRequestHandlerAfterCur****rent(new
>>> RedirectRequestHandler(newUrl)****);
>>>
>>>         }
>>>   }
>>>
>>> HTML:
>>>
>>> <form wicket:id="form" id="form" method="get" target="_blank">
>>>
>>>
>> The problem is that you use AjaxSubmit and thus 'target="_blank"' is not
>> used at all.
>>
>>
>>  ....
>>> <span class="button link"> <input wicket:id="submitButton"
>>> type="submit"/>
>>> </form>
>>>
>>>
>>> Has anyone dealt with such an issue or has any pointers how to approach
>>> this issue?
>>>
>>> Regards,
>>>
>>> Haiko
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> <us...@wicket.apache.org>
>>> >
>>>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: break out inlineframe with form submission

Posted by ha...@dds.nl.
Hi Martin,

For clarification, the problem is that the result is rendered in the  
inlineFrame ( IFrame ).
How can I have an Ajax submit with the same behavior as 'target="_blank"'?


Martin Grigorov <mg...@apache.org> schreef:

> Hi,
>
>
> On Fri, Oct 25, 2013 at 11:40 AM, <ha...@dds.nl> wrote:
>
>> Dear Wicketeers,
>>
>> I am puzzling how to break out of an inlineFrame ( IFrame ) on an form
>> submission. I have an a Form in a InlineFrame. The result of submitted this
>> form should be opening a new tab/ page.
>>
>> The code:
>>
>> Form form = new Form("form")
>>
>> ....
>>
>> AjaxSubmitLink submitButton = new AjaxSubmitLink("submitButton", form) {
>>
>>         @Override
>>         protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>>
>>
>>         getRequestCycle().**scheduleRequestHandlerAfterCur**rent(new
>> RedirectRequestHandler(newUrl)**);
>>         }
>>   }
>>
>> HTML:
>>
>> <form wicket:id="form" id="form" method="get" target="_blank">
>>
>
> The problem is that you use AjaxSubmit and thus 'target="_blank"' is not
> used at all.
>
>
>> ....
>> <span class="button link"> <input wicket:id="submitButton" type="submit"/>
>> </form>
>>
>>
>> Has anyone dealt with such an issue or has any pointers how to approach
>> this issue?
>>
>> Regards,
>>
>> Haiko
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail:  
>> users-unsubscribe@wicket.**apache.org<us...@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


Re: break out inlineframe with form submission

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Fri, Oct 25, 2013 at 11:40 AM, <ha...@dds.nl> wrote:

> Dear Wicketeers,
>
> I am puzzling how to break out of an inlineFrame ( IFrame ) on an form
> submission. I have an a Form in a InlineFrame. The result of submitted this
> form should be opening a new tab/ page.
>
> The code:
>
> Form form = new Form("form")
>
> ....
>
> AjaxSubmitLink submitButton = new AjaxSubmitLink("submitButton", form) {
>
>         @Override
>         protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>
>
>         getRequestCycle().**scheduleRequestHandlerAfterCur**rent(new
> RedirectRequestHandler(newUrl)**);
>         }
>   }
>
> HTML:
>
> <form wicket:id="form" id="form" method="get" target="_blank">
>

The problem is that you use AjaxSubmit and thus 'target="_blank"' is not
used at all.


> ....
> <span class="button link"> <input wicket:id="submitButton" type="submit"/>
> </form>
>
>
> Has anyone dealt with such an issue or has any pointers how to approach
> this issue?
>
> Regards,
>
> Haiko
>
>
>
>
>
>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>