OK, now I changed my code to this:

                add(nanp = new RadioChoice("nanp", new PropertyModel(this,
"phoneNumber.nanp"), Arrays.asList(new String[] {
                                "true", "false" })));
                nanp.add(new AjaxFormComponentUpdatingBehavior("onclick") {

                        private static final long serialVersionUID =
-1406454064553153207L;

                        @Override
                        protected void onUpdate(AjaxRequestTarget target) {
                                nanp.processInput();
                                target.addComponent(areaCode);
                                target.addComponent(countryDialingCode);
                                target.addComponent(routingDialingCode);
                        }
                });

What I don't understand is that when I click on a radio button and
onUpdate() gets called, RadioChoice.convertedInput is null.

-----Original Message-----
From: Zhubin Salehi [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2008 1:17 PM
To: users@wicket.apache.org
Subject: RE: Problem with using RadioGorup and AjaxEventBehavior in a
FormComponentPanel

I added the AjaxFormChoiceComponentUpdatingBehavior to Radio objects and I
got a runtime exception (can only be added to...), then I added it to the
RadioGroup and nothing happens when I change the selection!

-----Original Message-----
From: Igor Vaynberg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2008 1:07 PM
To: users@wicket.apache.org
Subject: Re: Problem with using RadioGorup and AjaxEventBehavior in a
FormComponentPanel

right. see AjaxFormChoiceComponentUpdatingBehavior

-igor


On Thu, Mar 20, 2008 at 10:02 AM, Zhubin Salehi
<[EMAIL PROTECTED]> wrote:
> I'm adding AjaxFormComponentUpdatingBehavior to RadioGroup. If I add it to
>  Radio I get a runtime exception that says
AjaxFormComponentUpdatingBehavior
>  can only be added to a FormComponent.
>
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>
>
> Sent: Thursday, March 20, 2008 12:59 PM
>  To: users@wicket.apache.org
>  Subject: Re: Problem with using RadioGorup and AjaxEventBehavior in a
>  FormComponentPanel
>
>  are you adding the bheavior to Radio or RadioGroup, it needs to go to
>  Radio components
>
>  -igor
>
>  On Thu, Mar 20, 2008 at 6:21 AM, Zhubin Salehi <[EMAIL PROTECTED]>
>  wrote:
>  > Ok, I noticed when I use AjaxFormComponentUpdatingBehavior, no
JavaScript
>  gets added to radio buttons.
>  >
>  >
>  >  -----Original Message-----
>  >  From: Zhubin Salehi [mailto:[EMAIL PROTECTED]
>  >  Sent: Thursday, March 20, 2008 9:18 AM
>  >  To: users@wicket.apache.org
>  >
>  >
>  > Subject: RE: Problem with using RadioGorup and AjaxEventBehavior in a
>  FormComponentPanel
>  >
>  >  onclick doesn't work either.
>  >
>  >  -----Original Message-----
>  >  From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>  >  Sent: Thursday, March 20, 2008 1:56 AM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: Problem with using RadioGorup and AjaxEventBehavior in a
>  FormComponentPanel
>  >
>  >  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: users@wicket.apache.org
>  >  >  >  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(Proper
>  tyResolver.java:1079)
>  >  >  >  >      at
>
org.apache.wicket.util.lang.PropertyResolver$ObjectAndGetSetter.setValue(Pro
>  pertyResolver.java:576)
>  >  >  >  >      at
>
org.apache.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:
>  130)
>  >  >  >  >      at
>
org.apache.wicket.model.AbstractPropertyModel.setObject(AbstractPropertyMode
>  l.java:164)
>  >  >  >  >      at
>  org.apache.wicket.Component.setModelObject(Component.java:2880)
>  >  >  >  >      at
>
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.j
>  ava: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(AbstractDefault
>  AjaxBehavior.java:288)
>  >  >  >  >      at
>
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.pr
>  ocessEvents(BehaviorRequestTarget.java:100)
>  >  >  >  >      at
>
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Abstra
>  ctRequestCycleProcessor.java:91)
>  >  >  >  >      at
>
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:116
>  6)
>  >  >  >  >      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(Application
>  FilterChain.java:269)
>  >  >  >  >      at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
>  ain.java:188)
>  >  >  >  >      at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
>  va:213)
>  >  >  >  >      at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
>  va: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.processC
>  onnection(Http11BaseProtocol.java:665)
>  >  >  >  >      at
>
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
>  a:528)
>  >  >  >  >      at
>
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
>  rkerThread.java:81)
>  >  >  >  >      at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
>  a: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]
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  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]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to