[ https://issues.apache.org/jira/browse/WICKET-1733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12904454#action_12904454 ]
Hudson commented on WICKET-1733: -------------------------------- Integrated in Apache Wicket 1.4.x #134 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/134/]) Issue: WICKET-1733 > WicketTester doesn't include form submitting component id in form submissions > ----------------------------------------------------------------------------- > > Key: WICKET-1733 > URL: https://issues.apache.org/jira/browse/WICKET-1733 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 1.3.3 > Reporter: David Shepherdson > Assignee: Igor Vaynberg > Priority: Minor > Fix For: 1.4.11, 1.5-M2 > > > When submitting a form with an AJAX link (or other AJAX-based control), > WicketTester doesn't include the id of the component that 'submitted' the > form, meaning that in situations with nested forms, the wrong form's > onSubmit() method may be called. > We're working around this problem by overriding the clickLink() and > executeAjaxEvent() methods as follows: > @Override > public void clickLink(String path, boolean isAjax) { > Component linkComponent = getComponentFromLastRenderedPage(path); > if (linkComponent instanceof AjaxSubmitLink) { > AjaxSubmitLink link = (AjaxSubmitLink) linkComponent; > Map<String, Object> requestParams = getParametersForNextRequest(); > requestParams.put(link.getInputName(), "x"); > } > super.clickLink(path, isAjax); > } > @Override > public void executeAjaxEvent(Component component, String event) { > // Code borrowed from BaseWicketTester. > // Run through all the behavior and select the LAST ADDED behavior > which > // matches the event parameter. > AjaxEventBehavior ajaxEventBehavior = null; > List behaviors = component.getBehaviors(); > for (Iterator iter = behaviors.iterator(); iter.hasNext();) { > IBehavior behavior = (IBehavior) iter.next(); > // AjaxEventBehavior is the one to look for > if (behavior instanceof AjaxEventBehavior) { > AjaxEventBehavior tmp = (AjaxEventBehavior) behavior; > if (event.equals(tmp.getEvent())) { > ajaxEventBehavior = tmp; > } > } > } > // Workaround: If the behaviour is an AjaxFormSubmitBehavior then add > the > // component's input name. > if (ajaxEventBehavior instanceof AjaxFormSubmitBehavior > && component instanceof FormComponent) { > String inputName = ((FormComponent) component).getInputName(); > Map<String, Object> requestParams = getParametersForNextRequest(); > requestParams.put(inputName, "x"); > } > super.executeAjaxEvent(component, event); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.