You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Wang <mi...@s1.com> on 2001/03/15 22:25:39 UTC

integer field

Does anyone know how to get rid of default value of 0 from integer input
field?
I would like to see empty field instead of 0 inside.

Any help will be appreciated
.
Thanks

--Michael


Re: integer field

Posted by Maya Muchnik <mm...@pumatech.com>.
The simplest way is to have this field as a String, and making a
conversion to String / Integer at ActionForm class.

Michael Wang wrote:

>
>
> Does anyone know how to get rid of default value of 0 from integer
> input field?
> I would like to see empty field instead of 0 inside.
>
> Any help will be appreciated
> .
> Thanks
>
> --Michael

Re: integer field

Posted by David Winterfeldt <dw...@yahoo.com>.
There isn't any way to this because the int will
always have some display value.  You would need to
have the field setup as a String and then convert it
to an integer later.  Also, you will probably want to
perform validation on the field to make sure it is an
integer.

David

--- Michael Wang <mi...@s1.com> wrote:
> 
> Does anyone know how to get rid of default value of
> 0 from integer input
> field?
> I would like to see empty field instead of 0 inside.
> 
> Any help will be appreciated
> .
> Thanks
> 
> --Michael
> 
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: integer field

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 15 Mar 2001, Michael Wang wrote:

> 
> Does anyone know how to get rid of default value of 0 from integer input
> field?
> I would like to see empty field instead of 0 inside.
> 

The best way to do this is to use a String property in your ActionForm
bean, rather than an int property.  That way, you can initialize the
visual appearance however you like (a null string will be displayed as an
empty field), and the error-redisplay logic will work correctly.

In your validate() method, one of the things you will want to check is
whether the conversion from String to integer was OK or not.

> Any help will be appreciated
> .
> Thanks
> 
> --Michael
> 
> 

Craig McClanahan