also, for what its worth, onclick works a lot better for this sort of
thing when dealing with check/readio html components
-igor
On Wed, Mar 19, 2008 at 10:55 PM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> i dont think browsers support an "onschange" event :)
>
> -igor
>
>
>
>
> On Wed, Mar 19, 2008 at 7:24 PM, Zhubin Salehi <[EMAIL PROTECTED]> wrote:
> > So now I wrote this code:
> >
> > nanp.add(new Radio("nanpTrue", new Model(new
> Boolean(true))));
> > nanp.add(new Radio("nanpFalse", new Model(new
> Boolean(false))));
> > nanp.add(new
> AjaxFormComponentUpdatingBehavior("onschange") {
> >
> >
> > private static final long serialVersionUID =
> -1406454064553153207L;
> >
> > protected void onUpdate(AjaxRequestTarget target) {
> >
> > nanp.processInput();
> > target.addComponent(areaCode);
> > target.addComponent(countryDialingCode);
> > target.addComponent(routingDialingCode);
> > }
> > });
> >
> > But onUpdate() method is not called when I change selection. What should
> I do?
> >
> > Thanks,
> > Zhubin
> >
> >
> >
> > -----Original Message-----
> > From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 19, 2008 6:04 PM
> > To: [email protected]
> > Subject: Re: Problem with using RadioGorup and AjaxEventBehavior in a
> FormComponentPanel
> >
> > ajax event behavior does not send over input. try
> > ajaxformcomponentupdatingbehavior.
> >
> > -igor
> >
> >
> > On Wed, Mar 19, 2008 at 2:19 PM, Zhubin Salehi <[EMAIL PROTECTED]> wrote:
> > > Hi all,
> > >
> > > I'm trying to update some TextFields in a FormComponentPanel when the
> user selects a radio button from a RadioGroup.
> > >
> > > Here is a fragment of my code that created Radio and RadioGroup
> objects:
> > >
> > > add(nanp = new RadioGroup("nanp", new PropertyModel(this,
> "phoneNumber.nanp")));
> > > nanp.add(new Radio("nanpTrue", new Model(new
> Boolean(true))).add(new AjaxEventBehavior("onchange") {
> > >
> > > private static final long serialVersionUID =
> -1406454064553153207L;
> > >
> > > protected void onEvent(AjaxRequestTarget target) {
> > > nanp.processInput();
> > > target.addComponent(areaCode);
> > > target.addComponent(countryDialingCode);
> > > target.addComponent(routingDialingCode);
> > > }
> > > }));
> > > nanp.add(new Radio("nanpFalse", new Model(new
> Boolean(false))).add(new AjaxEventBehavior("onchange") {
> > >
> > > private static final long serialVersionUID =
> 6475950784724594836L;
> > >
> > > protected void onEvent(AjaxRequestTarget target) {
> > > nanp.processInput();
> > > target.addComponent(areaCode);
> > > target.addComponent(countryDialingCode);
> > > target.addComponent(routingDialingCode);
> > > }
> > > }));
> > >
> > > The problem is that as soon as I click on one of the radio buttons, I
> get the following exception:
> > >
> > > WicketMessage: Can't convert null value to a primitive class: boolean
> for setting it on [EMAIL PROTECTED]
> > >
> > > Root cause:
> > >
> > > org.apache.wicket.util.convert.ConversionException: Can't convert null
> value to a primitive class: boolean for setting it on [EMAIL PROTECTED]
> > > at
> org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1079)
> > > at
> org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(PropertyResolver.java:576)
> > > at
> org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:130)
> > > at
> org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:164)
> > > at org.apache.wicket.Component.setModelObject(Component.java:2880)
> > > at
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1052)
> > > at
> org.apache.wicket.markup.html.form.FormComponent.processInput(FormComponent.java:934)
> > > at
> com.route1.mobi.map3.web.panels.PhoneNumberPanel$2.onEvent(PhoneNumberPanel.java:125)
> > > at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:161)
> > > at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:288)
> > > at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:100)
> > > at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
> > > at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1166)
> > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243)
> > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
> > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
> > > at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
> > > at
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> > > at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> > > at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> > > at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> > > at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
> > > at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> > > at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> > > at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> > > at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
> > > at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
> > > at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
> > > at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
> > > at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
> > > at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> > > at java.lang.Thread.run(Thread.java:595)
> > > It looks like the model in RadioGroup is not updated when
> nanp.processInput() is called. Any idea what I have done wrong?
> > >
> > > By the way I'm using Wicket 1.3.2, JDK 1.5.0_15, Tomcat 5.5.26 and
> Firefox 2.0.0.12
> > >
> > > Thanks,
> > > Zhubin
> > > Zhubin Salehi
> > > Senior Software Engineer
> > > Route1, Inc.
> > > Phone: (416) 848-8391 Ext. 2262 * Fax: (416) 848-8394
> > > [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> *
> www.route1.com<blocked::http://www.route1.com/>
> > > This electronic mail transmission contains information from Route1,
> Inc that is for the sole use of the intended recipient and may contain
> confidential, privileged or proprietary information. If you are not the
> intended recipient, please be aware that any disclosure, copying,
> distribution or use of this message, its contents, or any attachment is
> prohibited. Any wrongful interception of this message is punishable as a
> federal crime. If you have received this message in error, please return a
> copy to the sender by electronic mail indicating the error. Then, please
> destroy the original message and any copies from your computer. Thank you.
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]