AAAANNNNDDD...  It works!

With some gotchas.

There is an architectural mismatch between the Commons Validator and Spring. 
Struts (which it was designed for) passes an ActionForm to the validator,
which is populated with the string values that were submitted from the
browser form - it's a DTO.  Spring passes a populated command object to the
validator, which is a model object.  Any type mismatches / type conversions
have already been caught and handled. 

I have checkboxes that are backed by Booleans (as generated by AMP).  When
the ValidWhen rule parses out the form, the checkboxes have already been
converted to Booleans.  The ValidWhen parser calls the toString() method on
Booleans.  So the literal you're comparing the Boolean with would be either
"true" or "false".

Like so:

<var>
   <var-name>test</var-name>
   <var-value>((isChecked == "false") or (*this* != null))</var-value>
</var>

Of course, since springmodules' commons validator adaptation is a stale
mishmash of Commons Validator 1.1 and 1.3, it's kinda broken - especially
the javascript (not handling multiple radio buttons is just one problem). 
I've smacked around the JavascriptValidatorTag to 1.3-ify it and updated the
validator-rules.xml so it uses the newer js validation functions, but
really, it's time for Appfuse and the rest of the world to move on. 

Spring Javascript integration into Appfuse, anyone?


-- 
View this message in context: 
http://www.nabble.com/validation-validwhen-doesnot-work-tp16986057s2369p25531365.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to