What exactly is the problem with the new version of Wicket? Is the
behavior not executed at all?
I have a wicket application that implements a Form with multiple fields.
AJAX form updating behavior onChange() is implemented so that a value change
in one field will trigger reset of some other fields. All have been tested
working fine in wicket 1.5.5. Now I just migrated to 6.3.0, none of this
AJAX behavior is working! :-( Here is the code snippet that worked for
1.5.5. Could anyone please tell me what I need to change to get the AJAX
behavior to work with wicket 6.3.0? Thanks a lot!
public class MetaProfileForm extends Form<MetaProfile> {
...
DropDownChoice<MetaProfileType> profileTypeBox = new
DropDownChoice<MetaProfileType>("type",
new PropertyModel<MetaProfileType>(profile,
"type"),
Arrays.asList(MetaProfileType.values()),
new IChoiceRenderer<MetaProfileType>() {
private static final long
serialVersionUID = 1L;
@Override
public Object
getDisplayValue(MetaProfileType object) {
return object.name();
}
@Override
public String
getIdValue(MetaProfileType object, int index) {
return object.name();
}
}
);
profileTypeBox.setOutputMarkupId(true);
add(profileTypeBox);
profileTypeBox.add(new AjaxFormComponentUpdatingBehavior("onChange") {
private static final long serialVersionUID = 1L;
protected void onUpdate(AjaxRequestTarget target) {
resetFieldsPerProfileType(target);
//add any component that will be called in
resetFieldsPerProfileType()
target.add(oxeNodeBox);
target.add(freeNumRangeBox);
target.add(oxeProfileBox);
...
};
});
In resetFieldsPerProfileType(),
protected void resetFieldsPerProfileType(AjaxRequestTarget target) {
MetaProfileType selectedProfileType =
profileTypeBox.getModelObject();
if (selectedProfileType.equals(MetaProfileType.OXE))
{
oxeNodeAsteriskImg.add(new AttributeModifier("style",
"display:"));
oxeNodeLabel.add(new AttributeModifier("class",
"requiredLabel"));
oxeNodeBox.setChoices(getOXENodeList());
...
} else if (selectedProfileType.equals(MetaProfileType.OT))
{
//reset and reload some other fields
...
}
}
The corresponding HTML snippet:
<label for="profileType" wicket:id="profileTypeLabel"
class="requiredLabel">Metaprofile
Type</label>
<select id="profileType" name="profileType"
wicket:id="type">
<option>default</option>
</select>
<label for="oxeNode" wicket:id="oxeNodeLabel"
class="requiredLabel">OXE Node</label>
<select id="oxeNode" name="oxeNode" wicket:id="oxeNode">
<option selected>OXENode</option>
</select>
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/AJAX-not-working-after-migrating-from-wicket-1-5-5-to-6-3-0-tp4654065.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org