struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Turner" <tur...@blackbear.com>
Subject My dilema: Much improved version of requiredif ready, 1.1 or 1.2?
Date Thu, 06 Mar 2003 05:56:07 GMT
As I'm sure we've all noticed, the "requiredif" validation, although
seeming to be very popular, is a bear for first time users to
comprehend.  With that in mind, I've just finished a new validation
(which I'm calling "requiredwhen" to avoid confusion), which is much
simpler.  Here's a sample rule:

<field property="firstName" indexedListProperty="dependents" 
       depends="requiredwhen">
  <arg0 key="dependentlistForm.firstName.label"/>
  <var>
    <var-name>test</var-name>
    <var-value>(dependents[].lastName != null)</var-value>
  </var>
</field>

As you can see, you can now put any arbitrary booolean expression as the
test for required.  For example:

((dependents[].lastName == "James") and (options[1] == "true"))

If the parser sees "[]", it replaces it with the indexed property value
of the target field.

Here's the dilema.  I think it's a lot better than "requiredif", will
generate a lot less questions on struts-users, and let people do the
general types of checking they seem to want to do.  Also, since it's
just another rule being added to the Validation set, it shouldn't be
able to destabilize anything else in the release.  However, since it is
a new feature, I hesitate to add it to 1.1 because we're in freeze.

What do other people think?  Also, I used JavaCC to generate the parser,
there's should never be a need to regenerate the java files from the jtt
source, but should someone want to do it, they'd need to download
JavaCC.  Will this be a problem?

James

          New Gig!
 |   |   |   |   |   |   |   |
\|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
 V   V   V   V   V   V   V   V
Director of Software Development
Benefit Systems, Inc.
jturner@benefit-systems.com

Voice: 603-216-1620
Fax: 317-573-2016 



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


Mime
View raw message