You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Mehrle <mi...@ask.com> on 2008/03/17 21:55:55 UTC

Linking radio buttons to textfield model update

I've got a group of seven radio buttons, some of which are supposed to
be correlated with a textfield. Meaning, when I select a particular
radio button the textfield on its right side is supposed to get a cursor
focus. Similarly, whenever I change my radio button selection, I need
any previously entered text to be cleared (and the model as well).

I can imagine various scenarios of how to write this - is there a
default/easy approach without having to sling JavaScript?

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Linking radio buttons to textfield model update

Posted by Michael Mehrle <mi...@ask.com>.
Hello? Anyone?

-----Original Message-----
From: Michael Mehrle [mailto:michael.mehrle@ask.com] 
Sent: Wednesday, March 19, 2008 12:48 PM
To: users@wicket.apache.org
Subject: Linking radio buttons to textfield model update

Okay, this helps, but how do I link different components to each radio
button? If all my radio buttons would associate with a textfield it
would be easy because I would just do this:

group.add(new CheckGroupSelector("groupselector"));
ListView bar = new ListView("choices", foo.getChoices()) {

            protected void populateItem(ListItem item) {
                item.add(new Check("checkbox", item.getModel()));
                item.add(new Label("nameLabel", new
PropertyModel(item.getModel(), "name")));
                item.add(new TextField("nameField", new
PropertyModel(item.getModel(), "nameField")));
            }
        };
group.add(bar);

However, some of my radio buttons don't have text fields, so how do I do
this and still make it a group? Can I just manually group those into a
WMC and add that one the group? What I am trying to do is to be able to
grab my value despite each radio button being associated with a
different type of component (textfield, textarea, AutocompleteTextArea,
etc.).

Thanks!

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Tuesday, March 18, 2008 1:42 PM
To: users@wicket.apache.org
Subject: Re: Linking radio buttons to textfield model update

RadioChoice supports wantOnSelectionChangedNotification() you can use
that to get a callback whenever a new option is selected, then call
clearinput() on whatever textbox needs to be made blank

-igor

On Tue, Mar 18, 2008 at 1:36 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Anyone? I also forgot to mention that three of the radio buttons are
>  associated with a textbox, but two are not (radio buttons without
>  textfields). Would love to know how to build this and properly assign
>  the model.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Michael Mehrle [mailto:michael.mehrle@ask.com]
>  Sent: Monday, March 17, 2008 1:56 PM
>  To: users@wicket.apache.org
>  Subject: Linking radio buttons to textfield model update
>
>  I've got a group of seven radio buttons, some of which are supposed
to
>  be correlated with a textfield. Meaning, when I select a particular
>  radio button the textfield on its right side is supposed to get a
cursor
>  focus. Similarly, whenever I change my radio button selection, I need
>  any previously entered text to be cleared (and the model as well).
>
>  I can imagine various scenarios of how to write this - is there a
>  default/easy approach without having to sling JavaScript?
>
>  Michael
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Linking radio buttons to textfield model update

Posted by Michael Mehrle <mi...@ask.com>.
Okay, this helps, but how do I link different components to each radio
button? If all my radio buttons would associate with a textfield it
would be easy because I would just do this:

group.add(new CheckGroupSelector("groupselector"));
ListView bar = new ListView("choices", foo.getChoices()) {

            protected void populateItem(ListItem item) {
                item.add(new Check("checkbox", item.getModel()));
                item.add(new Label("nameLabel", new
PropertyModel(item.getModel(), "name")));
                item.add(new TextField("nameField", new
PropertyModel(item.getModel(), "nameField")));
            }
        };
group.add(bar);

However, some of my radio buttons don't have text fields, so how do I do
this and still make it a group? Can I just manually group those into a
WMC and add that one the group? What I am trying to do is to be able to
grab my value despite each radio button being associated with a
different type of component (textfield, textarea, AutocompleteTextArea,
etc.).

Thanks!

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Tuesday, March 18, 2008 1:42 PM
To: users@wicket.apache.org
Subject: Re: Linking radio buttons to textfield model update

RadioChoice supports wantOnSelectionChangedNotification() you can use
that to get a callback whenever a new option is selected, then call
clearinput() on whatever textbox needs to be made blank

-igor

On Tue, Mar 18, 2008 at 1:36 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Anyone? I also forgot to mention that three of the radio buttons are
>  associated with a textbox, but two are not (radio buttons without
>  textfields). Would love to know how to build this and properly assign
>  the model.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Michael Mehrle [mailto:michael.mehrle@ask.com]
>  Sent: Monday, March 17, 2008 1:56 PM
>  To: users@wicket.apache.org
>  Subject: Linking radio buttons to textfield model update
>
>  I've got a group of seven radio buttons, some of which are supposed
to
>  be correlated with a textfield. Meaning, when I select a particular
>  radio button the textfield on its right side is supposed to get a
cursor
>  focus. Similarly, whenever I change my radio button selection, I need
>  any previously entered text to be cleared (and the model as well).
>
>  I can imagine various scenarios of how to write this - is there a
>  default/easy approach without having to sling JavaScript?
>
>  Michael
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Linking radio buttons to textfield model update

Posted by Michael Mehrle <mi...@ask.com>.
Okay, this helps, but how do I link different components to each radio
button? If all my radio buttons would associate with a textfield it
would be easy because I would just do this:

group.add(new CheckGroupSelector("groupselector"));
ListView bar = new ListView("choices", foo.getChoices()) {

            protected void populateItem(ListItem item) {
                item.add(new Check("checkbox", item.getModel()));
                item.add(new Label("nameLabel", new
PropertyModel(item.getModel(), "name")));
                item.add(new TextField("nameField", new
PropertyModel(item.getModel(), "nameField")));
            }
        };
group.add(bar);

However, some of my radio buttons don't have text fields, so how do I do
this and still make it a group? Can I just manually group those into a
WMC and add that one the group? What I am trying to do is to be able to
grab my value despite each radio button being associated with a
different type of component (textfield, textarea, AutocompleteTextArea,
etc.).

Thanks!

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Tuesday, March 18, 2008 1:42 PM
To: users@wicket.apache.org
Subject: Re: Linking radio buttons to textfield model update

RadioChoice supports wantOnSelectionChangedNotification() you can use
that to get a callback whenever a new option is selected, then call
clearinput() on whatever textbox needs to be made blank

-igor

On Tue, Mar 18, 2008 at 1:36 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Anyone? I also forgot to mention that three of the radio buttons are
>  associated with a textbox, but two are not (radio buttons without
>  textfields). Would love to know how to build this and properly assign
>  the model.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Michael Mehrle [mailto:michael.mehrle@ask.com]
>  Sent: Monday, March 17, 2008 1:56 PM
>  To: users@wicket.apache.org
>  Subject: Linking radio buttons to textfield model update
>
>  I've got a group of seven radio buttons, some of which are supposed
to
>  be correlated with a textfield. Meaning, when I select a particular
>  radio button the textfield on its right side is supposed to get a
cursor
>  focus. Similarly, whenever I change my radio button selection, I need
>  any previously entered text to be cleared (and the model as well).
>
>  I can imagine various scenarios of how to write this - is there a
>  default/easy approach without having to sling JavaScript?
>
>  Michael
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Linking radio buttons to textfield model update

Posted by Michael Mehrle <mi...@ask.com>.
Okay, this helps, but how do I link different components to each radio
button? If all my radio buttons would associate with a textfield it
would be easy because I would just do this:

group.add(new CheckGroupSelector("groupselector"));
ListView bar = new ListView("choices", foo.getChoices()) {

            protected void populateItem(ListItem item) {
                item.add(new Check("checkbox", item.getModel()));
                item.add(new Label("nameLabel", new
PropertyModel(item.getModel(), "name")));
                item.add(new TextField("nameField", new
PropertyModel(item.getModel(), "nameField")));
            }
        };
group.add(bar);

However, some of my radio buttons don't have text fields, so how do I do
this and still make it a group? Can I just manually group those into a
WMC and add that one the group? What I am trying to do is to be able to
grab my value despite each radio button being associated with a
different type of component (textfield, textarea, AutocompleteTextArea,
etc.).

Thanks!

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Tuesday, March 18, 2008 1:42 PM
To: users@wicket.apache.org
Subject: Re: Linking radio buttons to textfield model update

RadioChoice supports wantOnSelectionChangedNotification() you can use
that to get a callback whenever a new option is selected, then call
clearinput() on whatever textbox needs to be made blank

-igor

On Tue, Mar 18, 2008 at 1:36 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Anyone? I also forgot to mention that three of the radio buttons are
>  associated with a textbox, but two are not (radio buttons without
>  textfields). Would love to know how to build this and properly assign
>  the model.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Michael Mehrle [mailto:michael.mehrle@ask.com]
>  Sent: Monday, March 17, 2008 1:56 PM
>  To: users@wicket.apache.org
>  Subject: Linking radio buttons to textfield model update
>
>  I've got a group of seven radio buttons, some of which are supposed
to
>  be correlated with a textfield. Meaning, when I select a particular
>  radio button the textfield on its right side is supposed to get a
cursor
>  focus. Similarly, whenever I change my radio button selection, I need
>  any previously entered text to be cleared (and the model as well).
>
>  I can imagine various scenarios of how to write this - is there a
>  default/easy approach without having to sling JavaScript?
>
>  Michael
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Linking radio buttons to textfield model update

Posted by Igor Vaynberg <ig...@gmail.com>.
RadioChoice supports wantOnSelectionChangedNotification() you can use
that to get a callback whenever a new option is selected, then call
clearinput() on whatever textbox needs to be made blank

-igor

On Tue, Mar 18, 2008 at 1:36 PM, Michael Mehrle <mi...@ask.com> wrote:
> Anyone? I also forgot to mention that three of the radio buttons are
>  associated with a textbox, but two are not (radio buttons without
>  textfields). Would love to know how to build this and properly assign
>  the model.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Michael Mehrle [mailto:michael.mehrle@ask.com]
>  Sent: Monday, March 17, 2008 1:56 PM
>  To: users@wicket.apache.org
>  Subject: Linking radio buttons to textfield model update
>
>  I've got a group of seven radio buttons, some of which are supposed to
>  be correlated with a textfield. Meaning, when I select a particular
>  radio button the textfield on its right side is supposed to get a cursor
>  focus. Similarly, whenever I change my radio button selection, I need
>  any previously entered text to be cleared (and the model as well).
>
>  I can imagine various scenarios of how to write this - is there a
>  default/easy approach without having to sling JavaScript?
>
>  Michael
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Linking radio buttons to textfield model update

Posted by Michael Mehrle <mi...@ask.com>.
Anyone? I also forgot to mention that three of the radio buttons are
associated with a textbox, but two are not (radio buttons without
textfields). Would love to know how to build this and properly assign
the model.

Michael

-----Original Message-----
From: Michael Mehrle [mailto:michael.mehrle@ask.com] 
Sent: Monday, March 17, 2008 1:56 PM
To: users@wicket.apache.org
Subject: Linking radio buttons to textfield model update

I've got a group of seven radio buttons, some of which are supposed to
be correlated with a textfield. Meaning, when I select a particular
radio button the textfield on its right side is supposed to get a cursor
focus. Similarly, whenever I change my radio button selection, I need
any previously entered text to be cleared (and the model as well).

I can imagine various scenarios of how to write this - is there a
default/easy approach without having to sling JavaScript?

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org