Re: AjaxFormComponentUpdatingBehavior Question
meduolis wrote: Again, I can offer a hack :D public class DoSomeHackBehavior extends AbstractBehavior { private static final long serialVersionUID = 3554634545756435367L; @Override public void onComponentTag(Component component, ComponentTag tag) { FormComponent? comp = (FormComponent?) component; tag.getAttributes().remove(onblur); } } } after that, you can add this behaviour to any component component.add(new DoSomeHackBehaviour()); :D Thanks again. But unfortunately the onblur Ajax called survived. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2990115.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior Question
Again, I can offer a hack :D public class DoSomeHackBehavior extends AbstractBehavior { private static final long serialVersionUID = 3554634545756435367L; @Override public void onComponentTag(Component component, ComponentTag tag) { FormComponent? comp = (FormComponent?) component; tag.getAttributes().remove(onblur); } } } after that, you can add this behaviour to any component component.add(new DoSomeHackBehaviour()); :D I have found that Wicket adds an onblur Ajax call to every HTML event you can define for the AjaxFormComponentUpdatingBehavior on a DropDownChoice control. I haven't tested this on other controls. This means your server will be getting an extra Ajax call each time a user moves focus away from the dropdown, even if they didn't change the dropdown selection. This seems like a bug. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2990266.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior Question
Doh! Never mind. I just discovered that buried in my Page was this piece of code: AjaxFormValidatingBehavior.addToAllFormComponents(form,onblur); That's what was adding the onblur call to the dropdown. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2990385.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AjaxFormComponentUpdatingBehavior Question
I have defined a dropdown using the AjaxFormComponentUpdatingBehavior for the onchange event. When I look at the html generated, the Ajax call is associated with both the onchange and the onblur events. I would like the call to be done only on the onchange event, not the onblur event. Is there a way to get Wicket to stop generating the onblur Ajax call? Here is the code defining the dropdown: endDateDropDown = new DropDownChoiceDate(endDateDropDown, new PropertyModel(viewHistoryCriteria, endDate), ProcessDateContext.getSixtyDayRange()); endDateDropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { if (criteriaDropDown.isEnabled()) { populateCriteriaDropdown(target); } } }); Here is the html generated which contains both the onchange and onblue event calls: select valign=top wicket:id=endDateDropDown name=criteriaPanel:endDateDropDown id=endDateDropDown onchange=var wcall=wicketAjaxPost('?wicket:interface=:1:historyForm:criteriaPanel:endDateDropDown::IBehaviorListener:0:', wicketSerialize(Wicket.$('endDateDropDown')),null,null, function() {return Wicket.$('endDateDropDown') != null;}.bind(this)); onblur=var wcall=wicketSubmitFormById('historyFormc', '?wicket:interface=:1:historyForm:criteriaPanel:endDateDropDown::IActivePageBehaviorListener:1:amp;wicket:ignoreIfNotActive=true', null,null,null, function() {return Wicket.$$(this)amp;amp;Wicket.$$('historyFormc')}.bind(this));; Thanks for your help with this. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2968982.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior Question
I dont know if it works, but you can try to make a hack :) endDateDropDown = new DropDownChoiceDate(endDateDropDown, new PropertyModel(viewHistoryCriteria, endDate), ProcessDateContext.getSixtyDayRange()); endDateDropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { if (criteriaDropDown.isEnabled()) { populateCriteriaDropdown(target); } } }); endDateDropDown.add(new AjaxFormComponentUpdatingBehavior(onblur) { protected void onUpdate(AjaxRequestTarget target) { // do nothing } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2969013.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior Question
meduolis wrote: I dont know if it works, but you can try to make a hack :) endDateDropDown = new DropDownChoiceDate(endDateDropDown, new PropertyModel(viewHistoryCriteria, endDate), ProcessDateContext.getSixtyDayRange()); endDateDropDown.add(new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate(AjaxRequestTarget target) { if (criteriaDropDown.isEnabled()) { populateCriteriaDropdown(target); } } }); endDateDropDown.add(new AjaxFormComponentUpdatingBehavior(onblur) { protected void onUpdate(AjaxRequestTarget target) { // do nothing } }); Thanks for your reply. I tried your suggestion, but Wicket still wrote an Ajax call for the onblur event. I would like to eliminate that call. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2969030.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior Question
Again, I can offer a hack :D public class DoSomeHackBehavior extends AbstractBehavior { private static final long serialVersionUID = 3554634545756435367L; @Override public void onComponentTag(Component component, ComponentTag tag) { FormComponent? comp = (FormComponent?) component; tag.getAttributes().remove(onblur); } } } after that, you can add this behaviour to any component component.add(new DoSomeHackBehaviour()); :D -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-Question-tp2968982p2969053.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org