have you tried:

onselectionchanged() { form.process(); } ?

-igor


On 5/18/07, kubino <[EMAIL PROTECTED]> wrote:


I made a functional code, so everyone can test it. What I want is that,
when
I click on radio button to automatically update textfields according to
their model. I do NOT want to use method textField.setModelValue(String d)
in onSelectionChanged method...

Thanks for help.


///html

<html>
<head>
</head>
<body>

<form wicket:id="myForm">

        <table>



                        <tr wicket:id="table">
                                <td><input type="radio"
wicket:id="sys_radio" /></td>
                                <td wicket:id="sys_name"> </td>
                                <td wicket:id="sys_desc"> </td>
                        </tr>



        </table>

<input type="text" wicket:id="textFieldName" />
<input type="text" wicket:id="textFieldDesc" />

</form>

</body>
</html>


// Wicket page


import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.Radio;
import wicket.markup.html.form.RadioGroup;
import wicket.markup.html.form.TextField;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.model.PropertyModel;


public class TestPage extends WebPage {


  private List<SystemM> systems = Arrays.asList(new SystemM("aa","aa"),new
SystemM("bb","bb"),new SystemM("cc","cc"));


  private SystemM selectedSystem;


  public TestPage() {

    Form myForm = new Form("myForm");

    selectedSystem = systems.get(0);


    RadioGroup radioGroup = new RadioGroup("radioGroup",new
PropertyModel(this,"selectedSystem")) {


      @Override
      protected boolean wantOnSelectionChangedNotifications() {
        return true;
      }

      @Override
      protected void onModelChanging() {

      }

      @Override
      protected void onSelectionChanged(Object arg0) {

      }
    };

      ListView table = new ListView("table", systems) {


      @Override
      protected void populateItem(final ListItem item) {

        final SystemM model = (SystemM)item.getModelObject();

          item.add(new Radio("sys_radio",item.getModel()));
          item.add(new Label("sys_name",model.getName()));
          item.add(new Label("sys_desc",model.getDesc()));

        }
    };


    TextField nameTextField = new TextField("textFieldName",new
PropertyModel(selectedSystem,"name"));
    TextField descTextField = new TextField("textFieldDesc",new
PropertyModel(selectedSystem,"desc"));

    radioGroup.add(table);

    myForm.add(radioGroup);

    myForm.add(nameTextField);
    myForm.add(descTextField);

    add(myForm);

}

  public class SystemM implements Serializable{

    private String name;
    private String desc;

    /**
     *
     */
    public SystemM(String n, String d) {

      this.name = n;
      this.desc = d;

    }

    public String getName() {
      return name;
    }
    public void setName(String name) {
      this.name = name;
    }
    public String getDesc() {
      return desc;
    }
    public void setDesc(String desc) {
      this.desc = desc;
    }



  }

  public SystemM getSelectedSystem() {
    return selectedSystem;
  }

  public void setSelectedSystem(SystemM selectedSystem) {
    this.selectedSystem = selectedSystem;
  }


}
--
View this message in context:
http://www.nabble.com/Updating-formComponents-on-round-trip-tf3770603.html#a10677724
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to