You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tsuresh <su...@hotmail.com> on 2007/11/26 08:14:19 UTC
Populate form according to selected item in dropdownchoice
Hello wicketeers,
I have a form to edit the attributes of User. User has the attributes
username, mail and role.I have a dropdownchoice filled with list of users.
When I select the user his mail should be displayed in textfield and his
role should be displayed in dropdownchoice. And i should be able to edit his
mail and role. I have already made the form to fill the first drop down
choice.I have made function view(username) in User class which helps in
viewing attributes of the user(user selected in dropdown), But I have no
idea to populate the remaining form components.How to do this? My code for
form is as below:
public UserEdit(){
User user= new user();
CompoundPropertyModel userEditModel = new
CompoundPropertyModel(user);
Form form = new userEditForm("user",userEditModel);
add(form);
add(new FeedbackPanel("feedback").setOutputMarkupId(true));
DropDownChoice ddc = null;
try{
ddc = new DropDownChoice("username",user.list());
}catch(SQLException e){
String err = e.getMessage();
}
TextField mailComp = new TextField("mail");
DropDownChoice roleDdc =null;
try{
roleDdc = new DropDownChoice("role.name",r.list());
}catch(SQLException e){
String err = e.getMessage();
}
form.add(ddc);
form.add(mailComp);
form.add(roleDdc);
}
class UserEditForm extends Form {
public UserEditForm(String id,IModel model) {
super(id,model);
}
--
View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13944776
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Populate form according to selected item in dropdownchoice
Posted by tsuresh <su...@hotmail.com>.
Thanks Dipu , I did it with the help of your code.
have a look at the attached files, thats based on your code snippet,
you will get the idea.
regards
dipu
--
View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a14023691
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Populate form according to selected item in dropdownchoice
Posted by Dipu Seminlal <di...@googlemail.com>.
have a look at the attached files, thats based on your code snippet,
you will get the idea.
regards
dipu
On Nov 27, 2007 7:17 AM, tsuresh <su...@hotmail.com> wrote:
>
> Hi Dipu,
> Could you please tell me what to write in the method
> onSelecitionChanged(). It would be easier for me to understand if you
> provide the code example. I studied the link
> http://cwiki.apache.org/WICKET/dropdownchoice-examples.html but could not
> understand it.
> thanks
>
>
> Dipu Seminlal wrote:
> >
> > there are two ways to do it
> >
> > override the wantOnSelectionChangedNotifications of the user dropdown
> > to return true and override onSelectionChanged to do what you want,
> > but this will result in server round trips ( refer the java of
> > DropDownChoice )
> >
> > or use an AjaxFormComponentUpdatingBehavior on the onChange event of
> > the dropdown.
> >
> > regards
> > Dipu
> >
> > On Nov 26, 2007 7:14 AM, tsuresh <su...@hotmail.com> wrote:
> >>
> >> Hello wicketeers,
> >> I have a form to edit the attributes of User. User has the attributes
> >> username, mail and role.I have a dropdownchoice filled with list of
> >> users.
> >> When I select the user his mail should be displayed in textfield and his
> >> role should be displayed in dropdownchoice. And i should be able to edit
> >> his
> >> mail and role. I have already made the form to fill the first drop down
> >> choice.I have made function view(username) in User class which helps in
> >> viewing attributes of the user(user selected in dropdown), But I have no
> >> idea to populate the remaining form components.How to do this? My code
> >> for
> >> form is as below:
> >>
> >> public UserEdit(){
> >>
> >> User user= new user();
> >> CompoundPropertyModel userEditModel = new
> >> CompoundPropertyModel(user);
> >> Form form = new userEditForm("user",userEditModel);
> >> add(form);
> >> add(new FeedbackPanel("feedback").setOutputMarkupId(true));
> >> DropDownChoice ddc = null;
> >> try{
> >> ddc = new DropDownChoice("username",user.list());
> >> }catch(SQLException e){
> >> String err = e.getMessage();
> >> }
> >>
> >> TextField mailComp = new TextField("mail");
> >> DropDownChoice roleDdc =null;
> >> try{
> >> roleDdc = new DropDownChoice("role.name",r.list());
> >> }catch(SQLException e){
> >> String err = e.getMessage();
> >> }
> >> form.add(ddc);
> >> form.add(mailComp);
> >> form.add(roleDdc);
> >> }
> >>
> >> class UserEditForm extends Form {
> >> public UserEditForm(String id,IModel model) {
> >> super(id,model);
> >> }
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13944776
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13965803
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Populate form according to selected item in dropdownchoice
Posted by tsuresh <su...@hotmail.com>.
Hi Dipu,
Could you please tell me what to write in the method
onSelecitionChanged(). It would be easier for me to understand if you
provide the code example. I studied the link
http://cwiki.apache.org/WICKET/dropdownchoice-examples.html but could not
understand it.
thanks
Dipu Seminlal wrote:
>
> there are two ways to do it
>
> override the wantOnSelectionChangedNotifications of the user dropdown
> to return true and override onSelectionChanged to do what you want,
> but this will result in server round trips ( refer the java of
> DropDownChoice )
>
> or use an AjaxFormComponentUpdatingBehavior on the onChange event of
> the dropdown.
>
> regards
> Dipu
>
> On Nov 26, 2007 7:14 AM, tsuresh <su...@hotmail.com> wrote:
>>
>> Hello wicketeers,
>> I have a form to edit the attributes of User. User has the attributes
>> username, mail and role.I have a dropdownchoice filled with list of
>> users.
>> When I select the user his mail should be displayed in textfield and his
>> role should be displayed in dropdownchoice. And i should be able to edit
>> his
>> mail and role. I have already made the form to fill the first drop down
>> choice.I have made function view(username) in User class which helps in
>> viewing attributes of the user(user selected in dropdown), But I have no
>> idea to populate the remaining form components.How to do this? My code
>> for
>> form is as below:
>>
>> public UserEdit(){
>>
>> User user= new user();
>> CompoundPropertyModel userEditModel = new
>> CompoundPropertyModel(user);
>> Form form = new userEditForm("user",userEditModel);
>> add(form);
>> add(new FeedbackPanel("feedback").setOutputMarkupId(true));
>> DropDownChoice ddc = null;
>> try{
>> ddc = new DropDownChoice("username",user.list());
>> }catch(SQLException e){
>> String err = e.getMessage();
>> }
>>
>> TextField mailComp = new TextField("mail");
>> DropDownChoice roleDdc =null;
>> try{
>> roleDdc = new DropDownChoice("role.name",r.list());
>> }catch(SQLException e){
>> String err = e.getMessage();
>> }
>> form.add(ddc);
>> form.add(mailComp);
>> form.add(roleDdc);
>> }
>>
>> class UserEditForm extends Form {
>> public UserEditForm(String id,IModel model) {
>> super(id,model);
>> }
>> --
>> View this message in context:
>> http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13944776
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13965803
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Populate form according to selected item in dropdownchoice
Posted by Gwyn Evans <gw...@gmail.com>.
Indeed - See the Wiki for more info, e.g.
http://cwiki.apache.org/WICKET/dropdownchoice-examples.html
/Gwyn
On 26/11/2007, Dipu Seminlal <di...@googlemail.com> wrote:
> there are two ways to do it
>
> override the wantOnSelectionChangedNotifications of the user dropdown
> to return true and override onSelectionChanged to do what you want,
> but this will result in server round trips ( refer the java of
> DropDownChoice )
>
> or use an AjaxFormComponentUpdatingBehavior on the onChange event of
> the dropdown.
>
> regards
> Dipu
>
> On Nov 26, 2007 7:14 AM, tsuresh <su...@hotmail.com> wrote:
> >
> > Hello wicketeers,
> > I have a form to edit the attributes of User. User has the attributes
> > username, mail and role.I have a dropdownchoice filled with list of users.
> > When I select the user his mail should be displayed in textfield and his
> > role should be displayed in dropdownchoice. And i should be able to edit his
> > mail and role. I have already made the form to fill the first drop down
> > choice.I have made function view(username) in User class which helps in
> > viewing attributes of the user(user selected in dropdown), But I have no
> > idea to populate the remaining form components.How to do this? My code for
> > form is as below:
> >
> > public UserEdit(){
> >
> > User user= new user();
> > CompoundPropertyModel userEditModel = new
> > CompoundPropertyModel(user);
> > Form form = new userEditForm("user",userEditModel);
> > add(form);
> > add(new FeedbackPanel("feedback").setOutputMarkupId(true));
> > DropDownChoice ddc = null;
> > try{
> > ddc = new DropDownChoice("username",user.list());
> > }catch(SQLException e){
> > String err = e.getMessage();
> > }
> >
> > TextField mailComp = new TextField("mail");
> > DropDownChoice roleDdc =null;
> > try{
> > roleDdc = new DropDownChoice("role.name",r.list());
> > }catch(SQLException e){
> > String err = e.getMessage();
> > }
> > form.add(ddc);
> > form.add(mailComp);
> > form.add(roleDdc);
> > }
> >
> > class UserEditForm extends Form {
> > public UserEditForm(String id,IModel model) {
> > super(id,model);
> > }
> > --
> > View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13944776
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>
--
Download Wicket 1.3.0-rc1 now! - http://wicketframework.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Populate form according to selected item in dropdownchoice
Posted by Dipu Seminlal <di...@googlemail.com>.
there are two ways to do it
override the wantOnSelectionChangedNotifications of the user dropdown
to return true and override onSelectionChanged to do what you want,
but this will result in server round trips ( refer the java of
DropDownChoice )
or use an AjaxFormComponentUpdatingBehavior on the onChange event of
the dropdown.
regards
Dipu
On Nov 26, 2007 7:14 AM, tsuresh <su...@hotmail.com> wrote:
>
> Hello wicketeers,
> I have a form to edit the attributes of User. User has the attributes
> username, mail and role.I have a dropdownchoice filled with list of users.
> When I select the user his mail should be displayed in textfield and his
> role should be displayed in dropdownchoice. And i should be able to edit his
> mail and role. I have already made the form to fill the first drop down
> choice.I have made function view(username) in User class which helps in
> viewing attributes of the user(user selected in dropdown), But I have no
> idea to populate the remaining form components.How to do this? My code for
> form is as below:
>
> public UserEdit(){
>
> User user= new user();
> CompoundPropertyModel userEditModel = new
> CompoundPropertyModel(user);
> Form form = new userEditForm("user",userEditModel);
> add(form);
> add(new FeedbackPanel("feedback").setOutputMarkupId(true));
> DropDownChoice ddc = null;
> try{
> ddc = new DropDownChoice("username",user.list());
> }catch(SQLException e){
> String err = e.getMessage();
> }
>
> TextField mailComp = new TextField("mail");
> DropDownChoice roleDdc =null;
> try{
> roleDdc = new DropDownChoice("role.name",r.list());
> }catch(SQLException e){
> String err = e.getMessage();
> }
> form.add(ddc);
> form.add(mailComp);
> form.add(roleDdc);
> }
>
> class UserEditForm extends Form {
> public UserEditForm(String id,IModel model) {
> super(id,model);
> }
> --
> View this message in context: http://www.nabble.com/Populate-form-according-to-selected-item-in-dropdownchoice-tf4873352.html#a13944776
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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