You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Richard W. Adams" <RW...@UP.COM> on 2013/03/01 18:53:33 UTC

AjaxSubmitLink.onSubmit() Not Called in FormComponentPanel

I created an AjaxSubmitLink in a FormComponent Panel, and set a break 
point in its onSubmit() method. For some reason, the breakpoint never gets 
hit when I click the link. I've used an AjaxSubmitLink on a normal, 
non-panel page successfully, and modeled the panelized link after that, so 
am not sure where the problem lies.

Here's the code where I create the link. The non-functioning break point 
is on the System.out.println() statement.

private Component createTrackLookupLink(final Form<?> form) {

        final AjaxSubmitLink link = new AjaxSubmitLink("track-lookup", 
form) {
                private static final long serialVersionUID = 
6256611774949674998L;
                @Override protected void onSubmit(final AjaxRequestTarget 
target, final Form<?> form) {

                        System.out.println("User clicked lookup icon");
                }
        };
        link.add(new Icon("track-lookup-icon", IconType.LOOKUP));
        return link;
}

I create the link from inside the panel constructor:

public PointLocationPanel(final String id, final 
IModel<PointFacilityLocation> model, final
        boolean box, final Collapsible collapsible, final boolean 
editable, final Form<?> form) {

        super(id, model);
        setType(PointFacilityLocation.class);
        setOutputMarkupId(true); 
        final MarkupContainer container = box ? new Box(CONTAINER_ID, 
"Location", collapsible) :
                new WebMarkupContainer(CONTAINER_ID);
        add(container);
        ...
        container.add(createTrackLookupLink(form));

I create the link from inside the panel constructor:

        final PointLocationPanel panel = new PointLocationPanel(
SWITCH_LOCATION, propertyModel,
                true, Collapsible.EXPANDED, userCanEditData, form);

        form.add(panel).add(createDetailsBox());

The enclosing form has its own onSubmit() method. It wouldn't prevent the 
link's onSubmit() method from beign called, would it?

When I click the link, I see this output in the Wicket Ajax debug window:

INFO: focus set on track_lookup20
INFO: Using XMLHttpRequest transport
INFO: 
INFO: 
Initiating Ajax POST request on ?wicket:interface=:4:switch-form:switchLocation:container:track-lookup::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&random=0.7709037117446776
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (69 characters)
INFO: 
<?xml version="1.0" encoding="UTF-8"?><ajax-response></ajax-response>
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...

**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**

Re: AjaxSubmitLink.onSubmit() Not Called in FormComponentPanel

Posted by "Richard W. Adams" <RW...@UP.COM>.
Yikes! You're right. OnError() was called instead of onSubmit(). (Hides 
red face & slinks away...)




From:   Sven Meier <sv...@meiers.net>
To:     users@wicket.apache.org
Date:   03/01/2013 12:24 PM
Subject:        Re: AjaxSubmitLink.onSubmit() Not Called in 
FormComponentPanel



Do you have unrendered feedback messages?
Override #onError() and see if it gets invoked.

Sven

On 03/01/2013 06:53 PM, Richard W. Adams wrote:
> I created an AjaxSubmitLink in a FormComponent Panel, and set a break
> point in its onSubmit() method. For some reason, the breakpoint never 
gets
> hit when I click the link. I've used an AjaxSubmitLink on a normal,
> non-panel page successfully, and modeled the panelized link after that, 
so
> am not sure where the problem lies.
>
> Here's the code where I create the link. The non-functioning break point
> is on the System.out.println() statement.
>
> private Component createTrackLookupLink(final Form<?> form) {
>
>          final AjaxSubmitLink link = new AjaxSubmitLink("track-lookup",
> form) {
>                  private static final long serialVersionUID =
> 6256611774949674998L;
>                  @Override protected void onSubmit(final 
AjaxRequestTarget
> target, final Form<?> form) {
>
>                          System.out.println("User clicked lookup icon");
>                  }
>          };
>          link.add(new Icon("track-lookup-icon", IconType.LOOKUP));
>          return link;
> }
>
> I create the link from inside the panel constructor:
>
> public PointLocationPanel(final String id, final
> IModel<PointFacilityLocation> model, final
>          boolean box, final Collapsible collapsible, final boolean
> editable, final Form<?> form) {
>
>          super(id, model);
>          setType(PointFacilityLocation.class);
>          setOutputMarkupId(true);
>          final MarkupContainer container = box ? new Box(CONTAINER_ID,
> "Location", collapsible) :
>                  new WebMarkupContainer(CONTAINER_ID);
>          add(container);
>          ...
>          container.add(createTrackLookupLink(form));
>
> I create the link from inside the panel constructor:
>
>          final PointLocationPanel panel = new PointLocationPanel(
> SWITCH_LOCATION, propertyModel,
>                  true, Collapsible.EXPANDED, userCanEditData, form);
>
>          form.add(panel).add(createDetailsBox());
>
> The enclosing form has its own onSubmit() method. It wouldn't prevent 
the
> link's onSubmit() method from beign called, would it?
>
> When I click the link, I see this output in the Wicket Ajax debug 
window:
>
> INFO: focus set on track_lookup20
> INFO: Using XMLHttpRequest transport
> INFO:
> INFO:
> Initiating Ajax POST request on 
?wicket:interface=:4:switch-form:switchLocation:container:track-lookup::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&random=0.7709037117446776
> INFO: Invoking pre-call handler(s)...
> INFO: Received ajax response (69 characters)
> INFO:
> <?xml version="1.0" encoding="UTF-8"?><ajax-response></ajax-response>
> INFO: Response parsed. Now invoking steps...
> INFO: Response processed successfully.
> INFO: Invoking post-call handler(s)...
>
> **
>
> This email and any attachments may contain information that is 
confidential and/or privileged for the sole use of the intended recipient. 
 Any use, review, disclosure, copying, distribution or reliance by others, 
and any forwarding of this email or its contents, without the express 
permission of the sender is strictly prohibited by law.  If you are not 
the intended recipient, please contact the sender immediately, delete the 
e-mail and destroy all copies.
> **
>


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




**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**

Re: AjaxSubmitLink.onSubmit() Not Called in FormComponentPanel

Posted by Sven Meier <sv...@meiers.net>.
Do you have unrendered feedback messages?
Override #onError() and see if it gets invoked.

Sven

On 03/01/2013 06:53 PM, Richard W. Adams wrote:
> I created an AjaxSubmitLink in a FormComponent Panel, and set a break
> point in its onSubmit() method. For some reason, the breakpoint never gets
> hit when I click the link. I've used an AjaxSubmitLink on a normal,
> non-panel page successfully, and modeled the panelized link after that, so
> am not sure where the problem lies.
>
> Here's the code where I create the link. The non-functioning break point
> is on the System.out.println() statement.
>
> private Component createTrackLookupLink(final Form<?> form) {
>
>          final AjaxSubmitLink link = new AjaxSubmitLink("track-lookup",
> form) {
>                  private static final long serialVersionUID =
> 6256611774949674998L;
>                  @Override protected void onSubmit(final AjaxRequestTarget
> target, final Form<?> form) {
>
>                          System.out.println("User clicked lookup icon");
>                  }
>          };
>          link.add(new Icon("track-lookup-icon", IconType.LOOKUP));
>          return link;
> }
>
> I create the link from inside the panel constructor:
>
> public PointLocationPanel(final String id, final
> IModel<PointFacilityLocation> model, final
>          boolean box, final Collapsible collapsible, final boolean
> editable, final Form<?> form) {
>
>          super(id, model);
>          setType(PointFacilityLocation.class);
>          setOutputMarkupId(true);
>          final MarkupContainer container = box ? new Box(CONTAINER_ID,
> "Location", collapsible) :
>                  new WebMarkupContainer(CONTAINER_ID);
>          add(container);
>          ...
>          container.add(createTrackLookupLink(form));
>
> I create the link from inside the panel constructor:
>
>          final PointLocationPanel panel = new PointLocationPanel(
> SWITCH_LOCATION, propertyModel,
>                  true, Collapsible.EXPANDED, userCanEditData, form);
>
>          form.add(panel).add(createDetailsBox());
>
> The enclosing form has its own onSubmit() method. It wouldn't prevent the
> link's onSubmit() method from beign called, would it?
>
> When I click the link, I see this output in the Wicket Ajax debug window:
>
> INFO: focus set on track_lookup20
> INFO: Using XMLHttpRequest transport
> INFO:
> INFO:
> Initiating Ajax POST request on ?wicket:interface=:4:switch-form:switchLocation:container:track-lookup::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&random=0.7709037117446776
> INFO: Invoking pre-call handler(s)...
> INFO: Received ajax response (69 characters)
> INFO:
> <?xml version="1.0" encoding="UTF-8"?><ajax-response></ajax-response>
> INFO: Response parsed. Now invoking steps...
> INFO: Response processed successfully.
> INFO: Invoking post-call handler(s)...
>
> **
>
> This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
> **
>


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