see the aggregate-sample with the 'switch' button
(of course that is a somewhat giving you the idea that you _should_ have multiple templates for one form, but you should at least notice that both templates mention ALL the widgets from the form-definition file)
Ok. I've looked at C2.1.5. Lot of new stuff. It looks interesting. Saddly I'm not web developer anymore and don't have so much time to spend on it as I used to have. I just want to be align. Everything looks fine. I managed to get my beutiful NIP validator. And... I'm a little bit disapointed. Why? Because fail message on aggregatefield isn't working correctly. My model looks like:
<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="integer"/>
</fd:field>
<fd:field id="part2">
<fd:label>-</fd:label>
<fd:datatype base="integer"/>
</fd:field>
<fd:field id="part3">
<fd:label>-</fd:label>
<fd:datatype base="integer"/>
</fd:field>
<fd:field id="part4">
<fd:label>-</fd:label>
<fd:datatype base="integer"/>
</fd:field>
</fd:widgets>
</fd:aggregatefield>
and template:
<fi:group> <fi:styling layout="row"/> <fi:items> <ft:aggregate-widget id="nip"> <ft:widget id="part1"/> <ft:widget id="part2"/> <ft:widget id="part3"/> <ft:widget id="part4"/> </ft:aggregate-widget> </fi:items> </fi:group>
Now, when I try to enter incorrect NIP it is validated and form won't be submited. That's correct. Saddly information that NIP is incorrect is not presented by '!'. Well if I'll provide letter insted of digit I will get '!' for incorrect field but I don't have '!' for whole aggregation. So if digits are correct form won't be submited and user won't get feedback why it happens. Is it possible to make it visible or is it a bug in cforms?
I think it is, I do hope you now also understand the 'danger' in this usage.
Hmm. Okey I agree. I just have an idea. Of course it is not possible with current implementation but it could be the way for multiforms. Consider that we have additional value stored in continuation session which will hold information about current view. Then we can add information to form template about views. I mean additional info for widget on which page it should be visible. Now, depending on current value of our variable stored in session cforms block can validate/trigger getting submited values/do other stuff only for widgets availiable for current view. Succesfuly validated form allow cforms to change value of variable stored in session and change current view. Leaving current continuation point would be possible only when user will go through all forms. In sucha solution we have both advantages from multiforms and continuation. Main idea was taken from XForms. I like almost everything about cforms but I think there were some good ideas also in XForms.
Kindly regards, Sebastian Gil
-- Thought by thought we see our own mistakes.
mailto: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]