cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Portier <...@outerthought.org>
Subject Re: Woody/Cocoon forms questions
Date Wed, 21 Apr 2004 20:47:22 GMT

Sebastian wrote:

>> Since this error is on the aggregate-widget and that one is not actually 
>> on the template, there is no position where the (!) should be next to.
>>
>> Therefor you need to explitely position it with a separate 
>> <ft:validation-error />
>>
>> see also here: 
>> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108176649831199&w=2
>> and here:
>> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107486651220426&w=2
>>
>> and let's thank Vadim :-)
> 
> Hmm. Very hacky :) Anyway. I think there is another bug there :) I don't 
> know
> if it's well known or if I should populate it on bugzilla.

from what I get now this sounds like a good idea

> Let me show my beautiful example :)
> 

it truly is a work of art!

>       <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>
> 
> "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

hm, supposing I understand what you are saying here my guess is that the 
validation on subwidgets isn't triggering the concattenation and 
subsequent validation on the aggregate level?

hm, this poses another interesting use case to the fact of 
setvalue/validation sequence (haven't looked in detail yet, maybe 
someone else has a better idea)

if my guess is close then you could probably work around this by adding 
additional validation rules on the split fields: i.e. adding validation 
rules enforcing the split-patterns on those substrings

(or even make their datatypes int and validate for minimum values or so, 
will not work for leading zeros though)

HTH
-marc=

> 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.".
> Bug or not bug? And is it a well known bug? :)
> 
> Kindly regards,
> 
> 
> -- 
> Thought by thought we see our own mistakes.
> 
> mailto: create@klub.chip.pl


-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message