You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Don Ferguson <do...@gmail.com> on 2015/04/12 20:42:53 UTC

Wicket 7: Problem hiding form from AjaxSubmitLink

Dear Wicket Boffins,

I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In the app there is a form whose AjaxSubmitLink hides the form as part of the submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException to be thrown, since the component that submitted the form is no longer visible.  What is the approved “wicket way” to do what I’m attempting?

Thanks in advance.

-Don

Here’s a stripped down version of the code:

JAVA:

public class TestPage extends WebPage {
    public TestPage() {
        Form form = new Form("form");
        form.add(new AjaxSubmitLink("submit") {
            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                super.onSubmit(target, form);
                form.setVisible(false);
                target.add(form);
            }
        });
        add(form.setOutputMarkupPlaceholderTag(true));
    }
}

HTML:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<body>
  <h3>Test Form Submit Hides Form</h3>

  <form wicket:id="form">
      <h4>Form Element</h4>
      <input type="submit" wicket:id="submit" value="Submit"/>
  </form>

</body>

EXCEPTION THROWN ON SUBMIT:
org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: Component rejected interface invocationComponent: [Form [Component id = form]] Listener: [RequestListenerInterface name=IFormSubmitListener, method=public abstract void org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
	at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212)
	at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241)
	at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
…


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


Re: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by Don Ferguson <do...@gmail.com>.
Done.

https://issues.apache.org/jira/browse/WICKET-5879 <https://issues.apache.org/jira/browse/WICKET-5879>


> On Apr 12, 2015, at 12:47 PM, Martin Grigorov <mg...@apache.org> wrote:
> 
> Hi,
> 
> Please create a quickstart app and attach it to a ticket at JIRA.
> Thanks!
> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> wrote:
> 
>> Dear Wicket Boffins,
>> 
>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In the
>> app there is a form whose AjaxSubmitLink hides the form as part of the
>> submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException to
>> be thrown, since the component that submitted the form is no longer
>> visible.  What is the approved “wicket way” to do what I’m attempting?
>> 
>> Thanks in advance.
>> 
>> -Don
>> 
>> Here’s a stripped down version of the code:
>> 
>> JAVA:
>> 
>> public class TestPage extends WebPage {
>>    public TestPage() {
>>        Form form = new Form("form");
>>        form.add(new AjaxSubmitLink("submit") {
>>            @Override
>>            protected void onSubmit(AjaxRequestTarget target, Form<?>
>> form) {
>>                super.onSubmit(target, form);
>>                form.setVisible(false);
>>                target.add(form);
>>            }
>>        });
>>        add(form.setOutputMarkupPlaceholderTag(true));
>>    }
>> }
>> 
>> HTML:
>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>> http://wicket.apache.org">
>> <body>
>>  <h3>Test Form Submit Hides Form</h3>
>> 
>>  <form wicket:id="form">
>>      <h4>Form Element</h4>
>>      <input type="submit" wicket:id="submit" value="Submit"/>
>>  </form>
>> 
>> </body>
>> 
>> EXCEPTION THROWN ON SUBMIT:
>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
>> Component rejected interface invocationComponent: [Form [Component id =
>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>> method=public abstract void
>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
>>        at
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212)
>>        at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241)
>>        at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
>> …
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


Re: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by andrea del bene <an...@gmail.com>.
Done! thank you guys.

On 14/04/2015 08:44, Martin Grigorov wrote:
> Hi,
>
> I think Sven's solution is more generic.
> Also it will be consistent with WICKET-5597
> On Apr 13, 2015 5:20 PM, "Sven Meier" <sv...@meiers.net> wrote:
>
>> Well, then we should change the type attribute as well, i.e. from "submit"
>> to "button".
>>
>> Why not just use #setPreventDefault(true)? Because if JavaScript is
>> disabled, the browser will still submit the form, without triggering the
>> callback on the AjaxSubmitLink.
>>
>> Regards
>> Sven
>>
>>
>> Am 13.04.2015 um 18:01 schrieb andrea del bene:
>>
>>> The case pointed out by Don is slightly different as the AjaxSubmitLink
>>> is attached to a <input type="submit"/> tag. Adding
>>> 'attributes.setPreventDefault(true);' in updateAttributes actually
>>> solves his problem.
>>>
>>> On 13/04/2015 14:32, Sven Meier wrote:
>>>
>>>> Hi Andrea,
>>>>
>>>> since WICKET-5597 AjaxSubmitLink already changes the button to prevent
>>>> default submitting of the form:
>>>>
>>>>      tag.put("type", "button");
>>>>
>>>> Have fun
>>>> Sven
>>>>
>>>>
>>>> Am 13.04.2015 um 14:19 schrieb Andrea Del Bene:
>>>>
>>>>> Due to WICKET-5197 I think we should add to
>>>>> 'attributes.setPreventDefault(true);' to  AjaxSubmitLink
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Please create a quickstart app and attach it to a ticket at JIRA.
>>>>>> Thanks!
>>>>>> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>   Dear Wicket Boffins,
>>>>>>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In
>>>>>>> the
>>>>>>> app there is a form whose AjaxSubmitLink hides the form as part of the
>>>>>>> submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException
>>>>>>> to
>>>>>>> be thrown, since the component that submitted the form is no longer
>>>>>>> visible.  What is the approved “wicket way” to do what I’m attempting?
>>>>>>>
>>>>>>> Thanks in advance.
>>>>>>>
>>>>>>> -Don
>>>>>>>
>>>>>>> Here’s a stripped down version of the code:
>>>>>>>
>>>>>>> JAVA:
>>>>>>>
>>>>>>> public class TestPage extends WebPage {
>>>>>>>       public TestPage() {
>>>>>>>           Form form = new Form("form");
>>>>>>>           form.add(new AjaxSubmitLink("submit") {
>>>>>>>               @Override
>>>>>>>               protected void onSubmit(AjaxRequestTarget target, Form<?>
>>>>>>> form) {
>>>>>>>                   super.onSubmit(target, form);
>>>>>>>                   form.setVisible(false);
>>>>>>>                   target.add(form);
>>>>>>>               }
>>>>>>>           });
>>>>>>>           add(form.setOutputMarkupPlaceholderTag(true));
>>>>>>>       }
>>>>>>> }
>>>>>>>
>>>>>>> HTML:
>>>>>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>>>>>>> http://wicket.apache.org">
>>>>>>> <body>
>>>>>>>     <h3>Test Form Submit Hides Form</h3>
>>>>>>>
>>>>>>>     <form wicket:id="form">
>>>>>>>         <h4>Form Element</h4>
>>>>>>>         <input type="submit" wicket:id="submit" value="Submit"/>
>>>>>>>     </form>
>>>>>>>
>>>>>>> </body>
>>>>>>>
>>>>>>> EXCEPTION THROWN ON SUBMIT:
>>>>>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
>>>>>>>
>>>>>>> Component rejected interface invocationComponent: [Form [Component id
>>>>>>> =
>>>>>>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>>>>>>> method=public abstract void
>>>>>>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
>>>>>>>
>>>>>>>           at
>>>>>>> org.apache.wicket.RequestListenerInterface.invoke(
>>>>>>> RequestListenerInterface.java:212)
>>>>>>>           at
>>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandle
>>>>>>> r.invokeListener(ListenerInterfaceRequestHandler.java:241)
>>>>>>>           at
>>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandle
>>>>>>> r.respond(ListenerInterfaceRequestHandler.java:234)
>>>>>>> …
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>> ---------------------------------------------------------------------
>> 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: Wicket 7: Problem hiding form from AjaxSubmitLink

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

I think Sven's solution is more generic.
Also it will be consistent with WICKET-5597
On Apr 13, 2015 5:20 PM, "Sven Meier" <sv...@meiers.net> wrote:

> Well, then we should change the type attribute as well, i.e. from "submit"
> to "button".
>
> Why not just use #setPreventDefault(true)? Because if JavaScript is
> disabled, the browser will still submit the form, without triggering the
> callback on the AjaxSubmitLink.
>
> Regards
> Sven
>
>
> Am 13.04.2015 um 18:01 schrieb andrea del bene:
>
>> The case pointed out by Don is slightly different as the AjaxSubmitLink
>> is attached to a <input type="submit"/> tag. Adding
>> 'attributes.setPreventDefault(true);' in updateAttributes actually
>> solves his problem.
>>
>> On 13/04/2015 14:32, Sven Meier wrote:
>>
>>> Hi Andrea,
>>>
>>> since WICKET-5597 AjaxSubmitLink already changes the button to prevent
>>> default submitting of the form:
>>>
>>>     tag.put("type", "button");
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>> Am 13.04.2015 um 14:19 schrieb Andrea Del Bene:
>>>
>>>> Due to WICKET-5197 I think we should add to
>>>> 'attributes.setPreventDefault(true);' to  AjaxSubmitLink
>>>>
>>>>> Hi,
>>>>>
>>>>> Please create a quickstart app and attach it to a ticket at JIRA.
>>>>> Thanks!
>>>>> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>  Dear Wicket Boffins,
>>>>>>
>>>>>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In
>>>>>> the
>>>>>> app there is a form whose AjaxSubmitLink hides the form as part of the
>>>>>> submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException
>>>>>> to
>>>>>> be thrown, since the component that submitted the form is no longer
>>>>>> visible.  What is the approved “wicket way” to do what I’m attempting?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> -Don
>>>>>>
>>>>>> Here’s a stripped down version of the code:
>>>>>>
>>>>>> JAVA:
>>>>>>
>>>>>> public class TestPage extends WebPage {
>>>>>>      public TestPage() {
>>>>>>          Form form = new Form("form");
>>>>>>          form.add(new AjaxSubmitLink("submit") {
>>>>>>              @Override
>>>>>>              protected void onSubmit(AjaxRequestTarget target, Form<?>
>>>>>> form) {
>>>>>>                  super.onSubmit(target, form);
>>>>>>                  form.setVisible(false);
>>>>>>                  target.add(form);
>>>>>>              }
>>>>>>          });
>>>>>>          add(form.setOutputMarkupPlaceholderTag(true));
>>>>>>      }
>>>>>> }
>>>>>>
>>>>>> HTML:
>>>>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>>>>>> http://wicket.apache.org">
>>>>>> <body>
>>>>>>    <h3>Test Form Submit Hides Form</h3>
>>>>>>
>>>>>>    <form wicket:id="form">
>>>>>>        <h4>Form Element</h4>
>>>>>>        <input type="submit" wicket:id="submit" value="Submit"/>
>>>>>>    </form>
>>>>>>
>>>>>> </body>
>>>>>>
>>>>>> EXCEPTION THROWN ON SUBMIT:
>>>>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
>>>>>>
>>>>>> Component rejected interface invocationComponent: [Form [Component id
>>>>>> =
>>>>>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>>>>>> method=public abstract void
>>>>>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
>>>>>>
>>>>>>          at
>>>>>> org.apache.wicket.RequestListenerInterface.invoke(
>>>>>> RequestListenerInterface.java:212)
>>>>>>          at
>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandle
>>>>>> r.invokeListener(ListenerInterfaceRequestHandler.java:241)
>>>>>>          at
>>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandle
>>>>>> r.respond(ListenerInterfaceRequestHandler.java:234)
>>>>>> …
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by Sven Meier <sv...@meiers.net>.
Well, then we should change the type attribute as well, i.e. from 
"submit" to "button".

Why not just use #setPreventDefault(true)? Because if JavaScript is 
disabled, the browser will still submit the form, without triggering the 
callback on the AjaxSubmitLink.

Regards
Sven


Am 13.04.2015 um 18:01 schrieb andrea del bene:
> The case pointed out by Don is slightly different as the 
> AjaxSubmitLink is attached to a <input type="submit"/> tag. Adding 
> 'attributes.setPreventDefault(true);' in updateAttributes actually 
> solves his problem.
>
> On 13/04/2015 14:32, Sven Meier wrote:
>> Hi Andrea,
>>
>> since WICKET-5597 AjaxSubmitLink already changes the button to 
>> prevent default submitting of the form:
>>
>>     tag.put("type", "button");
>>
>> Have fun
>> Sven
>>
>>
>> Am 13.04.2015 um 14:19 schrieb Andrea Del Bene:
>>> Due to WICKET-5197 I think we should add to 
>>> 'attributes.setPreventDefault(true);' to  AjaxSubmitLink
>>>> Hi,
>>>>
>>>> Please create a quickstart app and attach it to a ticket at JIRA.
>>>> Thanks!
>>>> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> 
>>>> wrote:
>>>>
>>>>> Dear Wicket Boffins,
>>>>>
>>>>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   
>>>>> In the
>>>>> app there is a form whose AjaxSubmitLink hides the form as part of 
>>>>> the
>>>>> submit.  In Wicket7, this causes a 
>>>>> ListenerInvocationNotAllowedException to
>>>>> be thrown, since the component that submitted the form is no longer
>>>>> visible.  What is the approved “wicket way” to do what I’m 
>>>>> attempting?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> -Don
>>>>>
>>>>> Here’s a stripped down version of the code:
>>>>>
>>>>> JAVA:
>>>>>
>>>>> public class TestPage extends WebPage {
>>>>>      public TestPage() {
>>>>>          Form form = new Form("form");
>>>>>          form.add(new AjaxSubmitLink("submit") {
>>>>>              @Override
>>>>>              protected void onSubmit(AjaxRequestTarget target, 
>>>>> Form<?>
>>>>> form) {
>>>>>                  super.onSubmit(target, form);
>>>>>                  form.setVisible(false);
>>>>>                  target.add(form);
>>>>>              }
>>>>>          });
>>>>>          add(form.setOutputMarkupPlaceholderTag(true));
>>>>>      }
>>>>> }
>>>>>
>>>>> HTML:
>>>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>>>>> http://wicket.apache.org">
>>>>> <body>
>>>>>    <h3>Test Form Submit Hides Form</h3>
>>>>>
>>>>>    <form wicket:id="form">
>>>>>        <h4>Form Element</h4>
>>>>>        <input type="submit" wicket:id="submit" value="Submit"/>
>>>>>    </form>
>>>>>
>>>>> </body>
>>>>>
>>>>> EXCEPTION THROWN ON SUBMIT:
>>>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: 
>>>>>
>>>>> Component rejected interface invocationComponent: [Form [Component 
>>>>> id =
>>>>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>>>>> method=public abstract void
>>>>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()] 
>>>>>
>>>>>          at
>>>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212) 
>>>>>
>>>>>          at
>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241) 
>>>>>
>>>>>          at
>>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) 
>>>>>
>>>>> …
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by andrea del bene <an...@gmail.com>.
The case pointed out by Don is slightly different as the AjaxSubmitLink 
is attached to a <input type="submit"/> tag. Adding 
'attributes.setPreventDefault(true);' in updateAttributes actually 
solves his problem.

On 13/04/2015 14:32, Sven Meier wrote:
> Hi Andrea,
>
> since WICKET-5597 AjaxSubmitLink already changes the button to prevent 
> default submitting of the form:
>
>     tag.put("type", "button");
>
> Have fun
> Sven
>
>
> Am 13.04.2015 um 14:19 schrieb Andrea Del Bene:
>> Due to WICKET-5197 I think we should add to 
>> 'attributes.setPreventDefault(true);' to  AjaxSubmitLink
>>> Hi,
>>>
>>> Please create a quickstart app and attach it to a ticket at JIRA.
>>> Thanks!
>>> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> wrote:
>>>
>>>> Dear Wicket Boffins,
>>>>
>>>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In 
>>>> the
>>>> app there is a form whose AjaxSubmitLink hides the form as part of the
>>>> submit.  In Wicket7, this causes a 
>>>> ListenerInvocationNotAllowedException to
>>>> be thrown, since the component that submitted the form is no longer
>>>> visible.  What is the approved “wicket way” to do what I’m attempting?
>>>>
>>>> Thanks in advance.
>>>>
>>>> -Don
>>>>
>>>> Here’s a stripped down version of the code:
>>>>
>>>> JAVA:
>>>>
>>>> public class TestPage extends WebPage {
>>>>      public TestPage() {
>>>>          Form form = new Form("form");
>>>>          form.add(new AjaxSubmitLink("submit") {
>>>>              @Override
>>>>              protected void onSubmit(AjaxRequestTarget target, Form<?>
>>>> form) {
>>>>                  super.onSubmit(target, form);
>>>>                  form.setVisible(false);
>>>>                  target.add(form);
>>>>              }
>>>>          });
>>>>          add(form.setOutputMarkupPlaceholderTag(true));
>>>>      }
>>>> }
>>>>
>>>> HTML:
>>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>>>> http://wicket.apache.org">
>>>> <body>
>>>>    <h3>Test Form Submit Hides Form</h3>
>>>>
>>>>    <form wicket:id="form">
>>>>        <h4>Form Element</h4>
>>>>        <input type="submit" wicket:id="submit" value="Submit"/>
>>>>    </form>
>>>>
>>>> </body>
>>>>
>>>> EXCEPTION THROWN ON SUBMIT:
>>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: 
>>>>
>>>> Component rejected interface invocationComponent: [Form [Component 
>>>> id =
>>>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>>>> method=public abstract void
>>>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()] 
>>>>
>>>>          at
>>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212) 
>>>>
>>>>          at
>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241) 
>>>>
>>>>          at
>>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) 
>>>>
>>>> …
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by Sven Meier <sv...@meiers.net>.
Hi Andrea,

since WICKET-5597 AjaxSubmitLink already changes the button to prevent 
default submitting of the form:

     tag.put("type", "button");

Have fun
Sven


Am 13.04.2015 um 14:19 schrieb Andrea Del Bene:
> Due to WICKET-5197 I think we should add to 
> 'attributes.setPreventDefault(true);' to  AjaxSubmitLink
>> Hi,
>>
>> Please create a quickstart app and attach it to a ticket at JIRA.
>> Thanks!
>> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> wrote:
>>
>>> Dear Wicket Boffins,
>>>
>>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In the
>>> app there is a form whose AjaxSubmitLink hides the form as part of the
>>> submit.  In Wicket7, this causes a 
>>> ListenerInvocationNotAllowedException to
>>> be thrown, since the component that submitted the form is no longer
>>> visible.  What is the approved “wicket way” to do what I’m attempting?
>>>
>>> Thanks in advance.
>>>
>>> -Don
>>>
>>> Here’s a stripped down version of the code:
>>>
>>> JAVA:
>>>
>>> public class TestPage extends WebPage {
>>>      public TestPage() {
>>>          Form form = new Form("form");
>>>          form.add(new AjaxSubmitLink("submit") {
>>>              @Override
>>>              protected void onSubmit(AjaxRequestTarget target, Form<?>
>>> form) {
>>>                  super.onSubmit(target, form);
>>>                  form.setVisible(false);
>>>                  target.add(form);
>>>              }
>>>          });
>>>          add(form.setOutputMarkupPlaceholderTag(true));
>>>      }
>>> }
>>>
>>> HTML:
>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>>> http://wicket.apache.org">
>>> <body>
>>>    <h3>Test Form Submit Hides Form</h3>
>>>
>>>    <form wicket:id="form">
>>>        <h4>Form Element</h4>
>>>        <input type="submit" wicket:id="submit" value="Submit"/>
>>>    </form>
>>>
>>> </body>
>>>
>>> EXCEPTION THROWN ON SUBMIT:
>>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: 
>>>
>>> Component rejected interface invocationComponent: [Form [Component id =
>>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>>> method=public abstract void
>>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()] 
>>>
>>>          at
>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212) 
>>>
>>>          at
>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241) 
>>>
>>>          at
>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) 
>>>
>>> …
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>


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


Re: Wicket 7: Problem hiding form from AjaxSubmitLink

Posted by Andrea Del Bene <an...@gmail.com>.
Due to WICKET-5197 I think we should add to 
'attributes.setPreventDefault(true);' to  AjaxSubmitLink
> Hi,
>
> Please create a quickstart app and attach it to a ticket at JIRA.
> Thanks!
> On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> wrote:
>
>> Dear Wicket Boffins,
>>
>> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In the
>> app there is a form whose AjaxSubmitLink hides the form as part of the
>> submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException to
>> be thrown, since the component that submitted the form is no longer
>> visible.  What is the approved “wicket way” to do what I’m attempting?
>>
>> Thanks in advance.
>>
>> -Don
>>
>> Here’s a stripped down version of the code:
>>
>> JAVA:
>>
>> public class TestPage extends WebPage {
>>      public TestPage() {
>>          Form form = new Form("form");
>>          form.add(new AjaxSubmitLink("submit") {
>>              @Override
>>              protected void onSubmit(AjaxRequestTarget target, Form<?>
>> form) {
>>                  super.onSubmit(target, form);
>>                  form.setVisible(false);
>>                  target.add(form);
>>              }
>>          });
>>          add(form.setOutputMarkupPlaceholderTag(true));
>>      }
>> }
>>
>> HTML:
>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
>> http://wicket.apache.org">
>> <body>
>>    <h3>Test Form Submit Hides Form</h3>
>>
>>    <form wicket:id="form">
>>        <h4>Form Element</h4>
>>        <input type="submit" wicket:id="submit" value="Submit"/>
>>    </form>
>>
>> </body>
>>
>> EXCEPTION THROWN ON SUBMIT:
>> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
>> Component rejected interface invocationComponent: [Form [Component id =
>> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
>> method=public abstract void
>> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
>>          at
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212)
>>          at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241)
>>          at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
>> …
>>
>>
>> ---------------------------------------------------------------------
>> 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: Wicket 7: Problem hiding form from AjaxSubmitLink

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

Please create a quickstart app and attach it to a ticket at JIRA.
Thanks!
On Apr 12, 2015 9:43 PM, "Don Ferguson" <do...@gmail.com> wrote:

> Dear Wicket Boffins,
>
> I have a Wicket 6 app that I’ve recently migrated to Wicket 7.   In the
> app there is a form whose AjaxSubmitLink hides the form as part of the
> submit.  In Wicket7, this causes a ListenerInvocationNotAllowedException to
> be thrown, since the component that submitted the form is no longer
> visible.  What is the approved “wicket way” to do what I’m attempting?
>
> Thanks in advance.
>
> -Don
>
> Here’s a stripped down version of the code:
>
> JAVA:
>
> public class TestPage extends WebPage {
>     public TestPage() {
>         Form form = new Form("form");
>         form.add(new AjaxSubmitLink("submit") {
>             @Override
>             protected void onSubmit(AjaxRequestTarget target, Form<?>
> form) {
>                 super.onSubmit(target, form);
>                 form.setVisible(false);
>                 target.add(form);
>             }
>         });
>         add(form.setOutputMarkupPlaceholderTag(true));
>     }
> }
>
> HTML:
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="
> http://wicket.apache.org">
> <body>
>   <h3>Test Form Submit Hides Form</h3>
>
>   <form wicket:id="form">
>       <h4>Form Element</h4>
>       <input type="submit" wicket:id="submit" value="Submit"/>
>   </form>
>
> </body>
>
> EXCEPTION THROWN ON SUBMIT:
> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
> Component rejected interface invocationComponent: [Form [Component id =
> form]] Listener: [RequestListenerInterface name=IFormSubmitListener,
> method=public abstract void
> org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
>         at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:212)
>         at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:241)
>         at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
> …
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>