You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Berlin Brown (JIRA)" <ji...@apache.org> on 2011/03/26 21:03:05 UTC

[jira] [Commented] (WICKET-3561) Cannot detect last AjaxLink or AjaxSubmitLink for a submitting form

    [ https://issues.apache.org/jira/browse/WICKET-3561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011677#comment-13011677 ] 

Berlin Brown commented on WICKET-3561:
--------------------------------------

It seems like you have to hack a solution to detect the state of the last button/link clicked.  Either we use session state or something similar.  It seems like an easy api to that particular event would be better.

Or even possibly some global "last behavior invoked?" or queued?



> Cannot detect last AjaxLink or AjaxSubmitLink for a submitting form
> -------------------------------------------------------------------
>
>                 Key: WICKET-3561
>                 URL: https://issues.apache.org/jira/browse/WICKET-3561
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.4.13
>         Environment: Windows, Unix, Java5, Java6, Tomcat
>            Reporter: Berlin Brown
>            Priority: Minor
>              Labels: ajaxlin,, ajaxsubmitlink,, form,, url,
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> This might qualify as a requested feature, If a particular ajax submit link was the last "behavior" associated with a form submission.  Basically, if I click on one of several different ajaxsubmitlinks on a form.  There doesn't seem like a good way to detect if that link was the last link clicked to submit the form.
> I tried to use the findSubmittingButton and that was always returning null for an ajaxsubmitlink.
> Does findSubmittingForm only work for buttons?
>  
> I used this approach and it works, but doesn't seem intuitintive and I wonder if there is a better way.
> Here is a use-case:
>   final Form<Bean > form = new Form<Bean>("form", formModel) {             
>             @Override            
>             protected void onSubmit() {
>                 if (this.findSubmittingButton() equals back or next button) {
>                       logic
>                       ... always returns null
>                 }
>              }
> }
> form.add(new AjaxSubmitLink("link", form)); 
> ....
> I tried the following in replace of find Submitting button and this works but I don't know if it is valid or will work with future version of wicket?
>         final String lastURL = form.getWebRequest().getURL();
>         return (lastURL.indexOf("nextLink") != -1);   or whatever the link is in the URL.
> ...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira