You can call formComponent#clearInput() in #onError() callback method. This way Wicket will use the last (valid) model value. You can also set custom model value in #onError() if you need.
Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Mar 5, 2015 at 9:39 AM, Thorsten Schöning <[email protected]> wrote: > Guten Tag Martin Grigorov, > am Donnerstag, 5. März 2015 um 08:05 schrieben Sie: > > > If the validation fails > > then the *raw* input is rendered to the user and there is no usage of > > #convertToString() because there is no need. > > Thanks, I wasn't aware of this and that explains why it looked like it > would work in other places, because there I have generated the exact > same values in convertToString like came from the browser and didn't > notice that the method wasn't ever called. > > But now I do need to render other values, in case of errors during > form validation Wicket needs to render other values than came form the > browser during the submit. Is there any way to do this? > > Some background: I have an Ajax auto complete input which searches > based on company names, but sends company IDs to Wicket. If other > forms on the page fail validation, I need to render the former > searched company names instead of their IDs back into the form. Wicket > by default renders IDs, because that's what it gets, but I thought I > can simply change that on the server during the render process somehow > back to company names. > > Mit freundlichen Grüßen, > > Thorsten Schöning > > -- > Thorsten Schöning E-Mail: [email protected] > AM-SoFT IT-Systeme http://www.AM-SoFT.de/ > > Telefon...........05151- 9468- 55 > Fax...............05151- 9468- 88 > Mobil..............0178-8 9468- 04 > > AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln > AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
