struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eirik Kjølsrud" <wayb...@frisurf.no>
Subject Re: Validation : Can't validate integer fields...
Date Wed, 04 Jun 2003 09:18:52 GMT
Hi Krishna,

and thank you very much for your help : )

I just added the lines you specified, and now it works perfectly !!

Thanks,
Eirik

"Krishnakumar N" <krishnakumar.n@ctp.ilabsgroup.com> skrev i melding
news:99E5EB82CE45D511845F00508BE95B4C9F360B@CTPNT002...
> Resending as previous mail seems to have got lost.
>
> Cheers,
> Krishna
>
> > -----Original Message-----
> > From: Krishnakumar N
> > Sent: Wednesday, June 04, 2003 2:04 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation : Can't validate integer fields...
> >
> >
> > I think this is a bug with the validator-rules.xml that ships
> > with rc1. The integer validation javascript may need to be
> > changed slightly as follows:
> >
> >
> > ...
> >                             if (!isAllDigits(value)) {
> > ++                                 if (i == 0) {
> > ++                                     focusField = field;
> > ++                                 }
> > ++                                 fields[i++] = oInteger[x][1];
> >                                 bValid = false;
> >                             } else {
> >                             var iValue = parseInt(value);
> >                             if (isNaN(iValue) ||
> > !(iValue >= -2147483648 && iValue <= 2147483647)) {
> >                                 if (i == 0) {
> >                                     focusField = field;
> >                                 }
> >                                 fields[i++] = oInteger[x][1];
> >                                 bValid = false;
> >                            }
> > ...
> >
> >  I do not know if this has been fixed in the latest cvs versions.
> >
> > Cheers,
> > Krishna
> >
> > > -----Original Message-----
> > > From: Eirik Kjølsrud [mailto:wayback@frisurf.no]
> > > Sent: Tuesday, June 03, 2003 8:30 PM
> > > To: struts-user@jakarta.apache.org
> > > Subject: Validation : Can't validate integer fields...
> > >
> > >
> > > Hi,
> > >
> > > I'm new to this group. I'm a java developer working currently
> > > on projects
> > > for the Norwegian National Lottery.
> > >
> > > In an input form, I'm trying to validate user input on the
> > > client, making
> > > sure that the values are integers. My problem is that no message is
> > > presented for "errors.integer", only for "errors.required". I
> > > have tried to
> > > list out some information in the javascript for integer
> > validation in
> > > 'validation-rules.xml', and the field is validated correctly.
> > > I also cannot
> > > submit the form unless all values are integers, but there is
> > > no messagebox
> > > telling the user what is wrong as it is when the field is empty.
> > >
> > > Any help would be appreciated : )
> > >
> > > Best Regards
> > > Eirik Kjølsrud, Norway
> > >
> > > Here are some details :
> > >
> > > I am using a DynaValidatorForm :
> > > <form-bean name="globalgameparamDynaValForm"
> > > type="org.apache.struts.validator.DynaValidatorForm">
> > >
> > > <form-property name="psp" type="java.lang.Integer"/>
> > >
> > > <form-property name="fsp" type="java.lang.Integer"/>
> > >
> > > <form-property name="postal0" type="java.lang.Integer"/>
> > >
> > > <form-property name="postal1" type="java.lang.Integer"/>
> > >
> > > <form-property name="postal2" type="java.lang.Integer"/>
> > >
> > > <form-property name="postal3" type="java.lang.Integer"/>
> > >
> > > <form-property name="module" type="java.lang.String"/>
> > >
> > > </form-bean>
> > >
> > > The part for the formset in the validation.xml file :
> > >
> > > <formset>
> > >
> > > <form name="globalgameparamDynaValForm">
> > >
> > > <field property="psp"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.psp.displayname"/>
> > >
> > > </field>
> > >
> > > <field property="fsp"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.fsp.displayname"/>
> > >
> > > </field>
> > >
> > > <field property="postal0"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.postal0.displayname"/>
> > >
> > > </field>
> > >
> > > <field property="postal1"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.fpostal1.displayname"/>
> > >
> > > </field>
> > >
> > > <field property="postal2"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.postal2.displayname"/>
> > >
> > > </field>
> > >
> > > <field property="postal3"
> > >
> > > depends="required,integer">
> > >
> > > <arg0 key="globalgameparamForm.postal3.displayname"/>
> > >
> > > </field>
> > >
> > > </form>
> > >
> > > </formset>
> > >
> > > And finally the ApplicationResources where the messages are
> > stored. As
> > > mentioned, the required message is presented, but not the integer :
> > >
> > > # Validator errormessages
> > >
> > > errors.required={0} må fylles ut.
> > >
> > > errors.integer={0} må være et heltall.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> >




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message