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


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

Reply via email to