You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/04/21 23:05:05 UTC
DO NOT REPLY [Bug 28522] New: -
fd:aggregatefield and fd:split pattern
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28522>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28522
fd:aggregatefield and fd:split pattern
Summary: fd:aggregatefield and fd:split pattern
Product: Cocoon 2
Version: Current CVS 2.1
Platform: Other
OS/Version: Other
Status: NEW
Severity: Major
Priority: Other
Component: CocoonForms
AssignedTo: dev@cocoon.apache.org
ReportedBy: create@insert.com.pl
Let me show my beautiful example :)
<fd:aggregatefield id="nip" required="false">
<fd:label>NIP:</fd:label>
<fd:datatype base="string">
<fd:validation>
<fd:nip>
<fd:failmessage>Invalid NIP number.</fd:failmessage>
</fd:nip>
</fd:validation>
</fd:datatype>
<fd:split pattern="([0-9]{3})-([0-9]{2,3})-([0-9]{2})-([0-9]{2,3})">
<fd:map group="1" field="part1"/>
<fd:map group="2" field="part2"/>
<fd:map group="3" field="part3"/>
<fd:map group="4" field="part4"/>
<fd:failmessage>Not a valid 10-digit NIP number.</fd:failmessage>
</fd:split>
<fd:combine expression='Concat(part1, "-", part2, "-", part3, "-", part4)
'/>
<fd:widgets>
<fd:field id="part1">
<fd:label>NIP:</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="part2">
<fd:label>-</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="part3">
<fd:label>-</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="part4">
<fd:label>-</fd:label>
<fd:datatype base="string"/>
</fd:field>
</fd:widgets>
</fd:aggregatefield>
NIP is a polish rate payer identificator. I've written validator for it
and then I've encountered following problem. "fd:split pattern" doesn't work
correctly. For example. If I'll fill just single field then I get a message "Not
a valid 10-digit NIP number.". That's correct. If I fill all fields with
integers I get "Invalid NIP number.". That's correct and not correct :) In fact
it is an invalid NIP, but I can provide value 1-1-1-1 which not match the
pattern and I should get "Not a valid 10-digit NIP number.". Moreover if I will
fill all fields but some of it will be a text instead of number I will get an
exception from my NIP validator :) because of course it'll be validated against
NIP rule not pattern. I've tried to change data types for parts to integer but
in this case it doesn't validate at all and always returns "Not a valid 10-digit
NIP number.".