use onclick instead of onchange

-igor


On 1/22/07, Marc-Andre Houle <[EMAIL PROTECTED]> wrote:

I was developing from home for my work last week and since I'm not a
Windows fan, I developed under OsX using Firefox, everything was great.
Today, I got an issue with AjaxEventBehavior.  It seem's that the event is
not generated the same way between firefox and IE7.  Can somebody tell me
how I can achieve the thing I want to do (When something is selected, check
if it represent something special immediately).  I'll paste a demo code
right here but here is what it do :

When I select a radio button, I change a variable and display it.
Under firefox, When the radio button is clicked, I got an event telling me
so inside the proper object
Under IE7, it call the event when I'm changing of radio button (1 is
selected, I go to 2) and is called from the last object (in this case, 1)

So, for example, making something appear when a radio button is selected
is a feature that will not work on IE7 since it will appear when I quit this
option, not when I enter it.  Is there a possible fix for this ??

Here is the quick start code :
-------------------------------------------------------
Markup :
-------------------------------------------------------
<div wicket:id="RadioGroup">
    <div wicket:id="ListView">
        <input type="radio" wicket:id="radio"/><span
wicket:id="label"></span>
    </div>
</div>
Selected radio button : <span wicket:id="selection"></span>
-------------------------------------------------------
Java :
-------------------------------------------------------
final RadioGroup radioGroup = new RadioGroup("RadioGroup", new Model());
final Label selectionLabel = new Label("selection", new
PropertyModel(this, "selection"));
selectionLabel.setOutputMarkupId (true);
ListView listView=new ListView("ListView", RadioList) {
    protected void populateItem (final ListItem item)
        {
        Radio radio = new Radio("radio", item.getModel());
        radio.add (new AjaxEventBehavior("onchange")
        {
            protected void onEvent (AjaxRequestTarget target)
            {
                System.out.println("Selected : " + item.getModelObject());
                setSelection (item.getModelObjectAsString ());
                target.addComponent (selectionLabel);
            }
        });
        item.add(radio);
        item.add(new Label("label", (String)item.getModelObject ()));
    }
};
radioGroup.add (listView);
add(radioGroup);
add(selectionLabel);

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to