On 25/07/05, Vandenbroucke Gregory <[EMAIL PROTECTED]> wrote:
> My action form fields are Integer or Float objects.
> The thing is, that I would like struts to leave the html fields empty, if
> some user entered alphanumeric text instead of numeric.
> Meaning that my ActionForm properties would be null instead of zero (which
> is semantically more correct). Is there a way to circumvent the auto
> population stuff?
> 
> Thanks,
> gregory
> 
> -----Original Message-----
> From: Kjersti Berg [mailto:[EMAIL PROTECTED]
> Sent: lundi 25 juillet 2005 11:52
> To: Struts Users Mailing List
> Subject: Re: Resetting ActionForm properties during validation
> 
> On 25/07/05, Vandenbroucke Gregory <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I have several forms which contain fields that should only accept numeric
> > data. If the entered data wasn't numeric, then during validation of that
> > field I would like to be able to leave the form field empty. But struts
> will
> > auto populate all fields. Meaning that for numeric fields it will enter
> > zero's if the entered data wasn't numeric.
> > Is there any way to circumvent this, and leave the form fields empty if
> the
> > entered data wasn't correct?

I believe there  was a discussion on this a few weeks ago. It is
generally not advised to use typed fields on the form so that the form
can contain invalid data and display them to the user. If you still
want to use typed fields you should probably do the validation
yourself in. The alternative is to create your own version of the
FieldCheck for numeric values. Search the archives for more specifics.

Kjersti

> 
> Are your your form fields strings? If so the user's input will be kept
> even if validation fails. If they are ints you get a 0 instead,
> because that is that that is the default value of an int.
> 
> Kjersti
> >
> > TIA,
> > Gregory.
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> 
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to