struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Dynavalidator Question:
Date Sat, 03 Mar 2007 18:41:30 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

James,

James Drinkard wrote:
> It's a multi-select option
> control. I put this in the struts-config.xml:
>
> <form-property name="interests" type="java.lang.String[]"/>
>
> but I'm not sure it's the correct syntax for an array.

Yes, that is the correct syntax for an array.

Now, what are you trying to validate, then?

Since you didn't provide enough information, I'll give you an example of
validation that I currently have working.

struts-config.xml:
<!-- questionnaireId should be int, multiple values -->
<form-property name="questionnaireId" type="java.lang.String[]" />


validator.xml:

	<!-- Note that the attribute "indexedListProperty" must be defined,
here, so that we can have the validator properly validate the array -->
	<field property="questionnaireId"
               indexedListProperty="questionnaireId"
               depends="required,integer">
	    <arg position="0" bundle="xxx"
                     key="form.report.questionnaireId.prompt" />
	</field>

So, this says that "questionnaireId" is required (must have at least one
value), and each individual one must be an integer.

Hope that helps.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF6cFa9CaO5/Lv0PARAlWfAJkBydKyCT5PRjvzuxOrz6iMlUQ16QCeIZc8
mCpZpIgFqyitXbanf3ofdBM=
=u7AB
-----END PGP SIGNATURE-----

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


Mime
View raw message