HiI had the same problem. The closest thing I found was, to create my own instance of TextField:
private static class MyTextField extends TextField { // constructors... protected void onComponentTag (ComponentTag tag) { super.onComponentTag(tag);String value = getValue(); // you can do anything here, for example to display a default value if the model value was null/empty
tag.put("value", value); } public String[] getInputAsArray () { String[] inputArray = super.getInputAsArray(); if (inputArray == null || inputArray.length == 0 || StringUtils.isBlank(inputArray[0])) { return EMPTY_STRING_ARRAY.clone(); } String value = inputArray[0].trim(); // modify value as needed. This is executed before the validator inputArray[0] = value; return inputArray; } } pixologe wrote:
Thanks for your ideas... But.... huh... is there really no "wicket way" to achieve this? After all I would not think that it is uncommon to fix simple things in user input before validation, e.g. trim strings, discard empty items in comma separated lists etc. Your solutions would work both I think, I just do not like the idea of doing things like these with javascript. Also, retrieving a String value from DB and wrapping it into an object just in order to be able to convert it back does not seem right to me... I'll probably stick to the js solution (reluctantly ;-), but if there is really no elegant way, I would love to see one in future wicket versions. Thanks for inspiration! best regards
-- [EMAIL PROTECTED] +41 44 268 83 98 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch ______________________________________________________________ e r g o n smart people - smart software
smime.p7s
Description: S/MIME Cryptographic Signature