like you were told, you have to add the textfield to the ajax target. also, if you want to repull the value from the model, textfield.clearinput() might do the trick.
-igor On Mon, Jun 8, 2009 at 10:44 PM, msteff<[email protected]> wrote: > > Could anybody help on this - please ? Or maybe give me a hint as to where to > start debugging this. I tried to follow the setLocale() to see what the > behaviour of wicket is, but i guess i have to start elsewhere.. > > Thanks for any answer! > > > > msteff wrote: >> >> Hi, >> I am having problems using nested forms and changing locale. >> >> I have 2 links for changing the locale. It works until i press the >> AjaxButton in the inner form. Hereafter the txtField's getObject is not >> called anymore. >> >> What am i doing wrong ? Any suggestions ? >> >> >> >> public class ProblemPage extends WebPage { >> private Map<String, String> map = new HashMap<String, String>(); >> >> public ProblemPage() { >> map.put("en", "Hello"); >> map.put("da", "Goddag"); >> >> getSession().setLocale(new Locale("en", "EN")); >> >> add(new Link("enLocale") >> { >> public void onClick() { >> getSession().setLocale(new Locale("en", "EN")); >> } >> }); >> add(new Link("daLocale") >> { >> public void onClick() { >> getSession().setLocale(new Locale("da", "DK")); >> } >> }); >> >> Form outerform = new Form("outerform") { >> protected void onSubmit() { >> super.onSubmit(); >> } >> }; >> add(outerform); >> >> TextField txtField = new TextField("txtfield",new Model() { >> public Object getObject() { >> return map.get(getSession().getLocale().getLanguage()); >> } >> >> public void setObject(Object o) { >> map.put(getSession().getLocale().getLanguage(),(String)o); >> } >> }); >> outerform.add(txtField); >> >> Form innerform = new Form("innerform") { >> protected void onSubmit() { >> super.onSubmit(); >> } >> }; >> outerform.add(innerform); >> >> AjaxButton editButton= new AjaxButton("pressmeButton") >> { >> protected void onSubmit(AjaxRequestTarget target, Form form) >> { >> super.onSubmit(); >> } >> }; >> editButton.add(new SimpleAttributeModifier("value","Press me")); >> // editButton.setDefaultFormProcessing(false); >> innerform.add(editButton); >> >> >> outerform.add(new AjaxButton("submitButton") { >> protected void onSubmit(AjaxRequestTarget target, Form form) >> { >> super.onSubmit(); >> } >> }); >> } >> } >> >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> >> <html> >> <head></head> >> >> <body> >> >> English >> Danish >> >> <form wicket:id="outerform"> >> <input type="text" wicket:id="txtfield"/> >> >> <form wicket:id="innerform"> >> <input type="button" wicket:id="pressmeButton"/> >> </form> >> >> <input type="button" value="Save" wicket:id="submitButton"/> >> </form> >> >> </body> >> </html> >> >> >> >> >> -- >> Kinds regards, >> Morten Steffensen >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > -- > View this message in context: > http://www.nabble.com/nested-forms-and-locale-tp23911537p23936648.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
