I used this code to test it (sorry for the Dutch words). The form to which
the group is ultimately added is in a parent component. Before this patch I
always saw Label l1, now it is switching between l1 and l2.

public class InvoerenNatuurlijkePersoonPanel extends Panel {

private Label l1;
    private Label l2;

    private boolean theValue = false;

    public InvoerenNatuurlijkePersoonPanel(String id) {
        super(id);

        List<String> choices = Arrays.asList(new String[]{"Ja", "Nee"});

        JaNeeToBooleanConvertingModel model = new
JaNeeToBooleanConvertingModel(new PropertyModel(this, "theValue"));
        RadioGroup rg = new RadioGroup("group", model);
        rg.add(new AjaxFormChoiceComponentUpdatingBehavior(){
            protected void onUpdate(AjaxRequestTarget target) {
                if (InvoerenNatuurlijkePersoonPanel.this.theValue) {
                    l1.setVisible(false);
                    l2.setVisible(true);
                }
                else {
                    l1.setVisible(true);
                    l2.setVisible(false);
                }
                target.addComponent(l1);
                target.addComponent(l2);
            }
        });

        ListView choiceList = new ListView("choiceList", choices){
            protected void populateItem(ListItem item) {
                item.add(new Radio("radio", item.getModel()));
                item.add(new Label("number", item.getModelObjectAsString
()));
            }
        }.setReuseItems(true);
        rg.add(choiceList);
        add(rg);

        l1 = new Label("l1", "Binnenlands");
        add(l1.setOutputMarkupPlaceholderTag(true));
        l2 = new Label("l2", "Buitenlands");
        l2.setVisible(false);
        add(l2.setOutputMarkupPlaceholderTag(true));
    }
}

2008/1/14, Martijn Lindhout <[EMAIL PROTECTED]>:
>
> It works! Thanx a lot!
>
> 2008/1/14, Igor Vaynberg <[EMAIL PROTECTED]>:
> >
> > how about this...
> >
> > https://issues.apache.org/jira/browse/WICKET-1271
> >
> > -igor
> >
> >
> > On Jan 14, 2008 12:46 PM, Martijn Lindhout < [EMAIL PROTECTED]>
> > wrote:
> > > Igor,
> > >
> > > I'm sorry, but could it be that the patch isn't visible to me? I just
> > signed
> > > up to ASF Jira to login, and I see no attachements at WICKET-1258 :-(
> > >
> > > 2008/1/14, Igor Vaynberg <[EMAIL PROTECTED]>:
> > > >
> > >
> > > > the patch is attached to the jira issue i mentioned
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Jan 14, 2008 12:20 PM, Martijn Lindhout <[EMAIL PROTECTED]
> > >
> > > > wrote:
> > > > > arg!!! You're right, 1.5 works.
> > > > >
> > > > > Ok Igor, do you have the change to commit or should I code it
> > myself
> > > > (would
> > > > > take some more time, because I'm not an experienced JavaScript
> > > > developer).
> > > > >
> > > > > 2008/1/14, Martin Funk <[EMAIL PROTECTED]>:
> > > > >
> > > > > >
> > > > > > what does
> > > > > >
> > > > > > java -version
> > > > > >
> > > > > > give you.
> > > > > >
> > > > > > I think on version 1.6 the tests still go boink like that.
> > > > > > Your jdk needs to be 1.5.
> > > > > >
> > > > > > mf
> > > > > >
> > > > > > Martijn Lindhout schrieb:
> > > > > > > unfortunately, I got Maven build errors doing just a mvn
> > install
> > > > from a
> > > > > > > 'fresh' download. Any idea?
> > > > > > >
> > > > > > > [surefire] Running org.apache.wicket.ajax.DomReadyOrderTest
> > > > > > > 7c7
> > > > > > > < </head>]]></header-contribution><component id="test1"
> > ><![CDATA[<a
> > > > > > > href="?wicket:interface=:0:test::ILinkListener::" onclick="var
> >
> > > > > > >
> > > > > >
> > > >
> > wcall=wicketAjaxGet('?wicket:interface=:0:test::IBehaviorListener:0:-1',null,null,
> > > > > > > function() {return Wicket.$('test1') !=
> > null;}.bind(this));return
> > > > > > !wcall;"
> > > > > > >
> > > > > >
> > > >
> > id="test1">Test</a>]]></component><evaluate><![CDATA[test1();]]></evaluate><evaluate><![CDATA[test2();]]></evaluate></ajax-response>
> >
> > > > > > > ---
> > > > > > >
> > > > > > >> </head>]]></header-contribution><component id="test1"
> > ><![CDATA[<a
> > > > > > >>
> > > > > > > id="test1" onclick="var
> > > > > > >
> > > > > >
> > > >
> > wcall=wicketAjaxGet('?wicket:interface=:0:test::IBehaviorListener:0:-1',null,null,
> >
> > > > > > > function() {return Wicket.$('test1') !=
> > null;}.bind(this));return
> > > > > > !wcall;"
> > > > > > >
> > > > > >
> > > >
> > href="?wicket:interface=:0:test::ILinkListener::">Test</a>]]></component><evaluate><![CDATA[test1();]]></evaluate><evaluate><![CDATA[test2();]]></evaluate></ajax-response>
> >
> > > > > > >
> > > > > > > [surefire] Tests run: 1, Failures: 1, Errors: 0, Time elapsed:
> > 0.017sec
> > > > > > > <<<<<<<< FAILURE !!
> > > > > > > [surefire] Running
> > > > org.apache.wicket.ajax.AjaxBehaviorAndMetaDataTest
> > > > > > > [surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed:
> > 0.006sec
> > > > > > > [surefire] Running
> > org.apache.wicket.ajax.AjaxRequestTargetTest
> > > > > > > 2c2
> > > > > > > < <style type="text/css"
> > > > id="org-apache-wicket-ajax-MockComponent1-0">
> > > > > > > ---
> > > > > > >
> > > > > > >> <style id="org-apache-wicket-ajax-MockComponent1-0"
> > > > type="text/css">
> > > > > > >>
> > > > > > >
> > > > > > > 2c2
> > > > > > > < <link
> > > > > > >
> > > > > >
> > > >
> > href="resources/org.apache.wicket.ajax.MockComponent3/mockStyleSheet3.css"
> > > > > > > rel="stylesheet" type="text/css"/>
> > > > > > > ---
> > > > > > >
> > > > > > >> <link rel="stylesheet" type="text/css"
> > > > > > >>
> > > > > > >
> > > > > >
> > > >
> > href="resources/org.apache.wicket.ajax.MockComponent3/mockStyleSheet3.css"/>
> > > > > > >
> > > > > > > [surefire] Tests run: 3, Failures: 2, Errors: 0, Time elapsed:
> > 0.106sec
> > > > > > > <<<<<<<< FAILURE !!
> > > > > > > [INFO]
> > > > > > >
> > > >
> > ------------------------------------------------------------------------
> > > > > > > [ERROR] BUILD ERROR
> > > > > > > [INFO]
> > > > > > >
> > > >
> > ------------------------------------------------------------------------
> > > > > > >
> > > > > > >
> > > > > > > 2008/1/14, Igor Vaynberg <[EMAIL PROTECTED]>:
> > > > > > >
> > > > > > >> if you dont mind testing the patch that would be great...
> > > > > > >>
> > > > > > >> -igor
> > > > > > >>
> > > > > > >>
> > > > > > >> On Jan 14, 2008 11:18 AM, Martijn Lindhout <
> > > > [EMAIL PROTECTED]>
> > > > > > >> wrote:
> > > > > > >>
> > > > > > >>> Uh.. oh, I'm sorry. Do you mean if I changed the source
> > according
> > > > to
> > > > > > >>>
> > > > > > >> Matt
> > > > > > >>
> > > > > > >>> Clark's comments? No.
> > > > > > >>> I deduced from the discussion that that would be the
> > problem.
> > > > > > >>>
> > > > > > >>> Of course I can download the source to apply the patch...
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> 2008/1/14, Igor Vaynberg < [EMAIL PROTECTED]>:
> > > > > > >>>
> > > > > > >>>> so you applied the patch and it worked? if so i can commit
> > it now
> > > > and
> > > > > > >>>> you can use the snapshot build
> > > > > > >>>>
> > > > > > >>>> -igor
> > > > > > >>>>
> > > > > > >>>>
> > > > > > >>>> On Jan 14, 2008 10:19 AM, Martijn Lindhout <
> > > > [EMAIL PROTECTED]>
> > > > > > >>>> wrote:
> > > > > > >>>>
> > > > > > >>>>> yep, you're right. Guess I'll have to wait till 1.3.1? ;-)
> > > > > > >>>>>
> > > > > > >>>>> 2008/1/14, Igor Vaynberg < [EMAIL PROTECTED]>:
> > > > > > >>>>>
> > > > > > >>>>>
> > > > > > >>>>>> could this be it?
> > > > > > >>>>>>
> > > > > > >>>>>> https://issues.apache.org/jira/browse/WICKET-1258
> > > > > > >>>>>>
> > > > > > >>>>>> also, the form should not be submitted, only the value
> > for that
> > > > > > >>>>>>
> > > > > > >> one
> > > > > > >>
> > > > > > >>>>>> radio component.
> > > > > > >>>>>>
> > > > > > >>>>>> -igor
> > > > > > >>>>>>
> > > > > > >>>>>>
> > > > > > >>>>>> On Jan 14, 2008 5:51 AM, Martijn Lindhout <
> > > > > > >>>>>>
> > > > > > >> [EMAIL PROTECTED] >
> > > > > > >>
> > > > > > >>>>>> wrote:
> > > > > > >>>>>>
> > > > > > >>>>>>> When I do this, the underlying model object isn't
> > updated. I
> > > > > > >>>>>>>
> > > > > > >> used
> > > > > > >>
> > > > > > >>>> the
> > > > > > >>>>
> > > > > > >>>>>> Wicket
> > > > > > >>>>>>
> > > > > > >>>>>>> Ajax Debug and see that the form isn't posted, so the
> > > > > > >>>>>>>
> > > > > > >> modelobject
> > > > > > >>
> > > > > > >>>>>> doesn't
> > > > > > >>>>>>
> > > > > > >>>>>>> change.
> > > > > > >>>>>>>
> > > > > > >>>>>>> 2008/1/14, SantiagoA <[EMAIL PROTECTED]>:
> > > > > > >>>>>>>
> > > > > > >>>>>>>
> > > > > > >>>>>>>> Hi,
> > > > > > >>>>>>>> what javascript method do you use?  onclick,
> > onMouseDown,
> > > > > > >>>>>>>>
> > > > > > >>>> onMouseUp?
> > > > > > >>>>
> > > > > > >>>>>>>> I add AjaxFormComponentUpdatingBehaviour("onchange") to
> > > > > > >>>>>>>>
> > > > > > >> Textfields
> > > > > > >>
> > > > > > >>>> and
> > > > > > >>>>
> > > > > > >>>>>> it
> > > > > > >>>>>>
> > > > > > >>>>>>>> works fine.
> > > > > > >>>>>>>> Using Radios in radioGroup i had to use
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>         radio.add(new AjaxEventBehavior("onchange"){
> > > > > > >>>>>>>>         private static final long serialVersionUID =
> > > > > > >>>>>>>> -5356375735369681460L;
> > > > > > >>>>>>>>         @Override
> > > > > > >>>>>>>>         protected void onEvent(AjaxRequestTarget
> > target) {
> > > > > > >>>>>>>>          do something;
> > > > > > >>>>>>>>          target.addComponent(panelA);
> > > > > > >>>>>>>>             target.addComponent(panelB);
> > > > > > >>>>>>>>            }
> > > > > > >>>>>>>> works fine for me.
> > > > > > >>>>>>>> cheers,
> > > > > > >>>>>>>> santiago
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>>>>> Martijn Lindhout wrote:
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>> Hi all
> > > > > > >>>>>>>>> I'm lost. I've tried all kinds of combinations to get
> > the
> > > > > > >>>>>>>>>
> > > > > > >>>> following
> > > > > > >>>>
> > > > > > >>>>>>>>> working,
> > > > > > >>>>>>>>> but I either received exceptions or nothing happened.
> > So
> > > > > > >>>>>>>>>
> > > > > > >> back to
> > > > > > >>
> > > > > > >>>>>> what I
> > > > > > >>>>>>
> > > > > > >>>>>>>>> want:
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>> I have a form with a question, which possible answers
> > are
> > > > > > >>>>>>>>>
> > > > > > >> 'yes'
> > > > > > >>
> > > > > > >>>> or
> > > > > > >>>>
> > > > > > >>>>>> 'no'.
> > > > > > >>>>>>
> > > > > > >>>>>>>> I
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>> want to use a radio choice for it. Depending on what
> > the
> > > > > > >>>>>>>>>
> > > > > > >> user
> > > > > > >>
> > > > > > >>>>>> chooses, I
> > > > > > >>>>>>
> > > > > > >>>>>>>>> want to show a panel A or B using Ajax. I started with
> > the
> > > > > > >>>>>>>>>
> > > > > > >>>>>> RadioChoice
> > > > > > >>>>>>
> > > > > > >>>>>>>>> component, but that way I have not enough control over
> > the
> > > > > > >>>>>>>>>
> > > > > > >>>> rendering
> > > > > > >>>>
> > > > > > >>>>>> of
> > > > > > >>>>>>
> > > > > > >>>>>>>>> the
> > > > > > >>>>>>>>> choices (CSS stuff etc), so I now have a radiogroup
> > and two
> > > > > > >>>>>>>>>
> > > > > > >>>> radio's.
> > > > > > >>>>
> > > > > > >>>>>> I
> > > > > > >>>>>>
> > > > > > >>>>>>>>> added
> > > > > > >>>>>>>>> a AjaxFormChoiceComponentUpdatingBehavior to the
> > RadioGroup.
> > > > > > >>>>>>>>>
> > > > > > >> In
> > > > > > >>
> > > > > > >>>> the
> > > > > > >>>>
> > > > > > >>>>>>>>> onUpdate, I check the model value. Depending on that
> > value I
> > > > > > >>>>>>>>>
> > > > > > >>>> modifiy
> > > > > > >>>>
> > > > > > >>>>>> the
> > > > > > >>>>>>
> > > > > > >>>>>>>>> visibility of the panels A and B and add both of them
> > to the
> > > > > > >>>>>>>>>
> > > > > > >>>> target.
> > > > > > >>>>
> > > > > > >>>>>>>> Point
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>> is: the onUpdate isn't called.
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>> What is the right way to do this?
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>> --
> > > > > > >>>>>>>>> Martijn Lindhout
> > > > > > >>>>>>>>> JointEffort IT Services
> > > > > > >>>>>>>>> http://www.jointeffort.nl
> > > > > > >>>>>>>>> [EMAIL PROTECTED]
> > > > > > >>>>>>>>> +31 (0)6 18 47 25 29
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>>>
> > > > > > >>>>>>>> --
> > > > > > >>>>>>>> View this message in context:
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>
> > > > > >
> > http://www.nabble.com/Ajax-enabled-radiogroup-tp14797035p14801893.html
> > > > > > >>>>
> > > > > > >>>>>>>> Sent from the Wicket - User mailing list archive at
> > > > Nabble.com
> > > > > > >>>>>>>>
> > > > > > >> .
> > > > > > >>
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>
> > > >
> > ---------------------------------------------------------------------
> > > > > > >>>>
> > > > > > >>>>>>>> To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > > > > >>>>>>>> For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>>>>>
> > > > > > >>>>>>> --
> > > > > > >>>>>>> Martijn Lindhout
> > > > > > >>>>>>> JointEffort IT Services
> > > > > > >>>>>>> http://www.jointeffort.nl
> > > > > > >>>>>>> [EMAIL PROTECTED]
> > > > > > >>>>>>> +31 (0)6 18 47 25 29
> > > > > > >>>>>>>
> > > > > > >>>>>>>
> > > > > > >>>>>>
> > > > > > >>
> > > >
> > ---------------------------------------------------------------------
> > > > > > >>
> > > > > > >>>>>> To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > > > > >>>>>> For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > > > > >>>>>>
> > > > > > >>>>>>
> > > > > > >>>>>>
> > > > > > >>>>> --
> > > > > > >>>>> Martijn Lindhout
> > > > > > >>>>> JointEffort IT Services
> > > > > > >>>>> http://www.jointeffort.nl
> > > > > > >>>>> [EMAIL PROTECTED]
> > > > > > >>>>> +31 (0)6 18 47 25 29
> > > > > > >>>>>
> > > > > > >>>>>
> > > > > > >>>>
> > > >
> > ---------------------------------------------------------------------
> > > > > > >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > > > > > >>>>
> > > > > > >>>>
> > > > > > >>>>
> > > > > > >>> --
> > > > > > >>> Martijn Lindhout
> > > > > > >>> JointEffort IT Services
> > > > > > >>> http://www.jointeffort.nl
> > > > > > >>> [EMAIL PROTECTED]
> > > > > > >>> +31 (0)6 18 47 25 29
> > > > > > >>>
> > > > > > >>>
> > > > > > >>
> > > >
> > ---------------------------------------------------------------------
> > > > > > >> 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]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > [EMAIL PROTECTED]
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > [EMAIL PROTECTED]
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> [EMAIL PROTECTED]
> +31 (0)6 18 47 25 29
>



-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29

Reply via email to