Hi,
I have a small but annoying problem. I'm sure there is a solution laying
around but let me ask it anyway.
This is a common zip code - location problem I intend to solve with actf.
I would like to get zip code read only (user can choose only location name).
To get my model up to date I introduced a hidden field.
...snippet.
final TextField bbsir_irszam_output = new
TextField("bbsirIrszam_out", new Model(((HrpBbstorzs)
model.getObject()).getBbsirIrszam()));
final HiddenField bbsir_irszam = new HiddenField("bbsirIrszam");
add(bbsir_irszam);
bbsir_irszam_output.setOutputMarkupId(true);
bbsir_irszam_output.setEnabled(false);
add(bbsir_irszam_output, new Label("sajatadatokform.irszam", new
ResourceModel("sajatadatokform.irszam")));
final AutoCompleteTextField helyseg = new
AutoCompleteTextField("helyseg", new Model("")) {
@Override
protected Iterator getChoices(String string) {
TelepulesIrszam = customBo.loadTelepulesek(string);
telepules = new ArrayList(TelepulesIrszam.keySet());
return telepules.iterator();
}
};
helyseg.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget art) {
try {
int irszam =
TelepulesIrszam.get(helyseg.getDefaultModelObjectAsString());
// find the zip code by location name selected
bbsir_irszam_output.setModelObject(irszam); // the
output field
bbsir_irszam.setModelObject(irszam); // the hidden
field
art.add(bbsir_irszam_output);
} catch (NullPointerException e) {
error("Hibás helységnév!");
art.add(container);
}
}
});
..
Thank you!
Regards., Sandor
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Update-two-fields-with-AjaxFormComponentUpdatingBehavior-tp4650954.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