Niall,

Thank you very much!  I will give your code a try.  Thanks for sharing.

TR

Niall Pemberton wrote:
Terry,

Hubert is right - validator doesn't support more than one level of indexed
validation. Basically the "indexedListProperty" element in your
validator.xml identifies a property in your ActionForm which is either a
collection or array. Validator simply uses that specifed property name to
retrieve the array/collection from the ActionForm and iterate over it. It
doesn't have any more sophisticated mechanism to do anything more complex
than one level.

I have a custom "validator" that provides an "inheritance" facility.  I
haven't tried it myself, but I believe it will do two levels of indexed
property validation - I've posted it on my web site. It only does server
side though - no javascript.

http://www.niallp.pwp.blueyonder.co.uk/#validateextends


Niall


----- Original Message ----- From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, September 14, 2004 8:11 PM
Subject: Re: Validation for Two Levels of Indexed Properties




Well, it's good to know you already have a solution working.

Just fyi, my guess on the two layers not being supported is based on
the example on

http://struts.apache.org/userGuide/dev_validator.html#validwhen

:

   <field property="quantity"
       indexedListProperty="orderLines"
       depends="validwhen">
     <arg0 key="orderform.quantity.label"/>
       <var>
         <var-name>test</var-name>
         <var-value>((orderLines[].partNumber == null) or (*this* !=
null))</var-value>
       </var>
     </field>

In the sample above, a <field> attribute had to be specified for the
indexed property.  I'm not sure how it'd be able to support another
layer of indexed properties since you can only specify one prop as
indexed.  (I'm sure you know that part; this is just for curious eyes
or archive searchers.)

Maybe Arron Bates (nested tags master) will one day find the
inspiration to write code to support nested validations, or maybe you
will!  But for now, you'll probably have to make do with what you have
running already.

Hubert

On Tue, 14 Sep 2004 12:54:59 -0600, Terry Roe <[EMAIL PROTECTED]> wrote:

Hubert,

Thank you for your response.  At present, I am using the Validator for
my first level of indexed properties and custom validation for the
second level.  I'd really like to use the Validator for everything as it
makes it much easier for maintenance and makes the code clearer when you
don't use two (or more) different techniques for validation.

I'm finding it hard to believe that there aren't other folks trying to
do the same thing, however.  As I mentioned, I've done a lot of
searching for information on this topic and come up empty.  All of the
examples in books, articles, and web tutorials deal with the nice, clean
first level of indexed properties and nesting.  I'd sure like to see
some of the "gurus" who are writing these books and articles take the
next step and start putting some meat on the examples.  I find that
there is plenty of information beginners using the technologies
separately.  Once you start combining the various tools and start doing
some real work, however, the effort to try to get things done and/or
find information increases exponentially.  I was hoping this mailing
list might be the port in the storm I was seeking.  I'm still hoping and
hopeful...

Thanks again,

TR

Hubert Rabago wrote:

Terry,

I share your concern about OT messages drowning out valid Struts
questions.  However, in this particular case, it could be a matter of
not a whole lot of people having experience with the problem.

For the situation you have, I have to say I just avoided it when I
encountered it.  At the time, I needed more out of my form than what I
wanted to do with Dyna*Form anyway, so I went the traditional
ActionForm way and did my validation in the validate() method.

I don't know enough about validator in order to confirm that
multi-level indexed property validation is not supported, but if I
*had* to guess, I'd say it isn't.  If I'm right, then other options
you can look at are creating a custom validator, or using the
traditional validate() method (on an ActionForm or a DynaActionForm
extension).

Hubert


On Tue, 14 Sep 2004 11:28:51 -0600, Terry Roe <

wrote:

Greetings,

I find it interesting that most of the recent activity on this mailing
list has to do with items such as .NET, AOP, Flash, Crystal Reports,

and

even Notepad! I don't mind the off topic posts, as they are usually

at

least tangentially related to the topic of this list and are

interesting

in themselves.  However, I have posted a couple of Struts questions
dealing with production code I am trying to develop and are directly
related to Struts usage.  I received a confirmation that one item

wasn't

currently supported in Struts (indexed property validation with
JavaScript), but no suggestions on how I might work around it, and
another on which I received no help, described below.

I'd think there'd be at least one or two gurus watching this list that
could at least say "you can't do that" or" here's what you might try."
I've seen the big guns respond to "easier" issues, but no one

addresses

"tough" ones like the one below.  Maybe it's too much effort, or maybe
I've breached protocol somehow in the way I've asked for help.  It

would

be nice to at least get a response to an issue that is directly

related

to the topic of this mailing list.

I don't mean to be rude, and I hope I'm not coming across that way.

But

I've searched and searched for information on the issue below and have
come up empty.  I came to the one place that I thought would be of

some

help and have received no response. Could someone please tell me

where

to go (and, yes, you may say GTH if that is the correct answer) to

find

answers to questions on Struts functionality and usage?

Thanks,

TR

Terry Roe wrote:
Re: Validation for Two Levels of Indexed Properties



Can Struts validate more than one level of indexed properties?  First
level works great.  Love it.  I've tried the following (phaseList and
procedureList are two indexed properties) to get more than one level

to

work without success:

<field property="units"
indexedListProperty="plan.phaseList.procedureList"
depends="required,intRange">

<field property="units"
indexedListProperty="plan.phaseList[].procedureList"
depends="required,intRange">

<field property="procedureList.units"
indexedListProperty="plan.phaseList" depends="required,intRange">

<field property="procedureList[].units"
indexedListProperty="plan.phaseList" depends="required,intRange">

Is multi-level, indexed property validation supported?  If so, can
someone relate the syntax to use?  If not, can someone confirm than

only

one level of indexed property validation is supported?

TR




---------------------------------------------------------------------
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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to