struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eirik Kjølsrud" <wayb...@frisurf.no>
Subject Validation : Can't validate integer fields...
Date Tue, 03 Jun 2003 15:00:23 GMT
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


Mime
View raw message