Hi,

I'm creating a text field to host an integer, namely the year that a house was 
built:
TextField<Integer> yearBuilt = new TextField<Integer>( "yearBuilt" 
).setRequired( true );

And I'm using a CompoundPropertyModel that maps "yearBuilt" to an underlying 
bean property. My problem is that the default value for an integer is "0", so 
the text field pre-populates its value to "0", which is a rather silly year 
built date ;)  What I would like to do is mark the field as required and 
validate against a number range, but display the text field without an initial 
value. 

I know I can make it a TextField<String> and then validate on submission, but 
what has me intrigued is my exploration into the DropDownChoice and the 
creation of renderers. For example, I have a dropdown list from which a user 
can choose a value between 0 and 50,000 (increments of 1000), but I built a 
custom renderer that displays "No Coverage" for "0" (insurance industry.) Can I 
build a custom renderer for the initial value of a text field so that if I see 
"0" I return "", otherwise I return the actual value, e.g. 2001?

Thanks in advance,
Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to