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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to