myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig McClanahan (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1467) Validation doesn't run for required fields if submitted value is null
Date Sun, 15 Oct 2006 03:54:36 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-1467?page=comments#action_12442364 ] 
            
Craig McClanahan commented on MYFACES-1467:
-------------------------------------------

> what do you say to my reasoning for cases where required is either true or false, depending
on the value of another component?

I say two things:

* JSF validation is all about single values -- cross field validation
  is left to the application, or to frameworks built on top of JSF
  (i.e. it's reasonable to build a "validation framework" extending
  JSF that does this kind of thing, but it's out of scope for the JSF
  validation APIs themselves, at least for 1.0).

* Firing validators on null values doesn't solve your use case anyway.  You are going
  to need to do something application specific anyway.  The current APIs
  are nowhere near rich enough to express all of the possible cross field
  scenarios that you would need to cover to be complete.

In the short term (i.e. before you can convince some future JSF expert group to change this),
the best advice might be to build a standalone validation framework that deals with all the
possible cross-field type issues, rather than trying to coerce individual components to behave
differently than the JSF standard ones do.  Also, keep an eye on JSRs like #303 (annotations
based validation rules), which will be playing in this same space.



> Validation doesn't run for required fields if submitted value is null
> ---------------------------------------------------------------------
>
>                 Key: MYFACES-1467
>                 URL: http://issues.apache.org/jira/browse/MYFACES-1467
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.2.0-SNAPSHOT, 1.1.5-SNAPSHOT
>            Reporter: David Chandler
>         Assigned To: Matthias We├čendorf
>         Attachments: patch.txt
>
>
> A component with a required value will not fail validation as expected if the submitted
value is null. This issue is not seen normally because browsers send the value for an empty
text field as an empty string. That is, the POST data for an empty field1 will contain the
field name but no value, like field1=&field2=something. However, if you use a man-in-the-middle
proxy such as Paros to remove "fieldname=" from the POST data, the submitted value will be
null. UIInput.validate() skips validation for null submitted values, but since requiredness
is also part of validation, the requiredness check gets skipped, too.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message