OK, After doing some research, I call modelChanging and modelChanged();

   
            @Override
            protected void onUpdate( final AjaxRequestTarget target ) {
                
     
CALL form.modelChanging();

             SelectionOptionBean myChildSelected =
(SelectionOptionBean)getFormComponent().getDefaultModelObject();
             final myBean myBeanLoc = form.getModelObject();
 
THIS CODE BELOW THE VALUES ARE SET !!!
              myBean selectedChild = getChildDataFromData();
              myBeanLoc.setFirstName(selectedChild.getFirstName());
              myBeanLoc.setLastName(selectedChild.getLastName());
              myBeanLoc.setMiddleName(selectedChild.getMiddleName());

CALL form.modelChanged();
 
             target.addComponent(ccc);            }
        } );
...

 

-----Original Message-----
From: Brown, Berlin [GCG-PFS]

Debugging Problem.  I am trying to debug an issue where I set
modelobject values for a form but the values do not appear in the text
fields onUpdate (AFTER ERROR) encountered.
 
Environment:
 
A. Wicket 1.4.13
B. Ajax Tabbed Panel
C. Modal Window
D. Child Modal Window has a form (compound property model) E. Form has
text components F. Form has a drop down box, on change the behavior set
model values.
F. Form has a abstract validator
 
Recreating the issue:
 
1. Click on link to bring up modal window 2. Click on drop down box,
ajax form behavior on change, sets values in text fields.
3. Click on drop down box, ajax form behavior on change, sets values in
text fields (this part works FINE!!)
 
4. Click the null value/default selection on drop drown box 5. Click
ajax save link 6. ERROR generated
 
7, go back to step 3 and click on the drop down box, now the values do
NOT UPDATE IN THE TEXT FIELDS (but they worked in step 3).
 
Basically, my ajax drop down worked fine WITHOUT THE error, but after a
validation error, the text field values do not appear in the form.
 
...
 
Debugging the issue.
 
It is strange that the model seems to have the value I want but in the
raw input does not.  
 
Here is me overriding behavior in the textfield:
 
MyTextField {
...
    @Override
    protected void onComponentTag(final ComponentTag tag)
    {
        System.out.println("----->:textComponent:modelValue:" +
getModelValue());
        System.out.println("----->:textComponent:rawInput:" +
getRawInput());
        System.out.println("----->:textComponent:getValue:" +
getValue());        
 
        // Default handling for component tag
        super.onComponentTag(tag);
    }
}
 
...Output:
 
SystemOut     O :==>222y:George
SystemOut     O ----->:textComponent:modelValue:George
SystemOut     O ----->:textComponent:rawInput:
SystemOut     O ----->:textComponent:getValue:
 
Why is the model value NOT null but the raw input is?
 
...
 
Some more code:
 
...
 
final Form<myBean> form = new Form<myBean>("calloutForm",
compoundPropertyModelForForm);
 
...
 
final MyDropDownChoice childList = new MyDropDownChoice("childList",
dropDownModelChild, renderer);    
  childListContainer.add(childList);
  childList.add( new AjaxFormComponentUpdatingBehavior("onchange") {
           
             
            @Override
            protected void onUpdate( final AjaxRequestTarget target ) {
                
                BaseWicketSession.get().getFeedbackMessages().clear();
             BaseWicketSession.get().cleanupFeedbackMessages();
             SelectionOptionBean myChildSelected =
(SelectionOptionBean)getFormComponent().getDefaultModelObject();
             final myBean myBeanLoc = form.getModelObject();
 
THIS CODE BELOW THE VALUES ARE SET !!!
              myBean selectedChild = getChildDataFromData();
              myBeanLoc.setFirstName(selectedChild.getFirstName());
              myBeanLoc.setLastName(selectedChild.getLastName());
              myBeanLoc.setMiddleName(selectedChild.getMiddleName());
 
             target.addComponent(ccc);
             System.out.println(":==>221x:" + myBeanLoc);
             System.out.println(":==>222y:" + myBeanLoc.getFirstName() +
"-" + myBeanLoc.getLastName()); 
             System.out.println("!!");
            }
        } );
...
 
final AjaxSubmitLink saveLink = new AjaxSubmitLink("saveLink", form) {
            @Override
            public void onSubmit(final AjaxRequestTarget target, final
Form<?> form) {  
             
                modalWindow.onSave(target, null);
                target.addComponent(form);
            }                       
        };
 
...
WITH THE ERROR, the HTML renders WITHOUT THE values.  But when I print
the model object values, it looks like they are there.
 
OUTPUT FROM THE HTML:
 
input type="text" size="28" maxlength="20" class="field" value=""
name="lastName"/>


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

Reply via email to