In the example below.
 
StepOne: user enters INVALID DATA
StepTwo: user hits the SAVE LINK (see below)
StepThree: error is displayed in feedback panel
StepFour:  user enters to select drop down, onchange
StepFiveERROR :: the code below should update the model, see Line12
 
But when the panel is displayed the textboxes don't have the value
"Hello"
 
When I do onchange from the dropdown, the value is set to empty.  If
there is NO ERROR from the validation then everything is fine.
 
Possible issue? I tried to clear the error messages onUpdate but that
didn't help.    I also added onError event and the error was only hit
during validation.
 
It is strange because onUpdate is called and it looks like the value is
getting set in the model (Line12) but that value is not displayed in the
textfield.
 
Only Other Solution?  Maybe I need to do a force "submit" in the
onChange/onUpdate method?
 
 
Pseudo Code:
 
Panel {
 
  Form form = new Form(new CompoundPropertyModel());
  add(form);
  form.add(new TextField("val");
  form.add(childList = new DropDownChoice()); 
  childList.add( new AjaxFormComponentUpdatingBehavior("onchange") {


      protected void onUpdate( final AjaxRequestTarget target ) {

           /// Tried clearing the messages here, does not work.         

          Line12: form.getObjectModel().setVal("Hello");
<------------------------- VALUE NOT BEING REFRESHED ON ERROR when I
redisplay the panel.

           target.addComponent(panel);

           target.addComponent(form);

      }

  });
 
  form.add(new MyValidator());  <-------------- VALIDATE, HAS ERROR!!!S
 
  form.add(new AjaxSubmitLink(form)) {
       
     onSubmit() {
        save();
        moveToNextScreen();
     }
   
  }
  
 
}
 
 
 

Reply via email to