Alex,

        Thanks for the response.  If I understand you right, if I want to
know whether all the required fields are filled in, the types are correct,
or the constraints are met I will have to have a check for EACH element
that has one or more of these bindings via the xxforms:valid attribute?  I
realize I could iterate through the all the fields but there is no way to
determine if the entire document is valid or not valid with a single
statement/call?

        With the following in the atm page-flow.xml:  

        <page id="enter-pin" path-info="/atm" xforms="enter-pin-form.xml"
view="enter-pin-view.xsl">
                <action id="enter" when="/form/action = 'submit'"
action="enter-pin-action.xsl">
                        <result id="valid" when="/valid = 'true'"
page="view-account"/>
                        <result id="invalid" when="/valid = 'false'"/>
                </action>
        </page>

        The enter-pin-action.xsl should not be invoked until the initial
document is submitted, correct?  When I made the bind change to the model
and the change to enter-pin-action.xsl you mentioned below the INITIAL
page shows up with the invalid field warning.  Does this mean I need the
opposite statement in the enter-pin-view.xsl or the page-flow.xml?  ie

     <valid xsl:version="2.0"
             xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
             xmlns:xxforms="http://orbeon.org/oxf/xml/xforms";>
         <xsl:value-of
             select="/form/[EMAIL PROTECTED]:valid = 'false']"/>
     </valid>

        It seems to me the document should behave in the following way:
        1) the page is presented to the client without validation.
        2) the client submits the instance data and the entire
document(instance data) returns whether the it meets all the bindings so
you could say in the xpl or xsl if instance_valid == true do x else do y
        3) x would be: the next page in the page-flow 
        4) y would be: present the page again with all the validation
errors visible

        I think I am missing something obvious here but I don't see what
that is.

Very Respectfully,
Gregory J Blajian

Gregory Blajian wrote:

> In the ATM example the pin is validated but it is done in
> the XPL vice through a bind property.  I apologize if this question has
> been asked before but I didn't see it in the archive.

The "trick" here is that when an element is validated (because there 
is a type, constraint, or required attribute on a bind expression 
pointing to that element in the XForms model), the XForms engine adds 
an xxforms:valid="true|false" attribute to the element. You have 
access to this attribute in your action, MVC model, and epilogue (i.e. 
everywhere you have access to the XForms instance).

In the ATM example, if you want the validation to be performed with a 
model item property, you would add this to the XForms model:

     <xforms:bind nodeset="/form/pin" constraint=". = '42'"/>

And the enter-pin-action.xsl would look for the xxforms:valid attribute:

     <valid xsl:version="2.0"
             xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
             xmlns:xxforms="http://orbeon.org/oxf/xml/xforms";>
         <xsl:value-of
             select="not(/form/[EMAIL PROTECTED]:valid = 'false'])"/>
     </valid>

Alex


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
orbeon-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to