cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emond Papegaaij <>
Subject Problem with cForms and validation
Date Mon, 15 Nov 2004 20:10:07 GMT

We are using cForms with the standard cForms validation for some time now. A 
couple of days ago I decided to upgrade to the latest Cocoon snapshot, 
however with this snapshot the validation doesn't work as expected anymore. 
Somewhere a change has been made to the way Cocoon handles validation of 
fields that were left blank. It now tries to validate a null reference, which 
leads to a NullPointerException. I've seen this happen with 'normal' text 
fields, fields with a converter to Integer, aggregate fields with fd:regexp 
and with custom validation classes.

I don't think it makes sense to validate a null reference as it should always 
be considered correct when the field is not required. Reverting to Cocoon solved it, so it's definitely a problem introduced somewhere in the 
new Cocoon version. Is it a bug or is it the way it's supposed to be? It 
makes the combination of validation with non-required fields quite useless.

Best regards,
Emond Papegaaij

Here is a snapshot of the definition of a field that is causing problems when 
left blank:
<fd:aggregatefield id="poBoxZipCode">
  <fd:datatype base="string"/>
  <fd:split pattern="([1-9]{1}[0-9]{3}) ?([a-zA-Z]{2})">
    <fd:map field="digits" group="1"/>
    <fd:map field="letters" group="2"/>
  <fd:combine expression="Concat( digits, letters )"/>
    <fd:field id="digits">
      <fd:datatype base="string">
          <fd:regexp pattern="[1-9]{1}[0-9]{3}">
            <fd:failmessage>CUT ERROR</fd:failmessage>
    <fd:field id="letters">
      <fd:datatype base="string">
          <fd:regexp pattern="[a-zA-Z]{2}">
            <fd:failmessage>CUT ERROR</fd:failmessage>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message