It works very well, however I'm still unable to hide error messages on first display and then to display them after input error. I tried to make the same thing as in bizdoc example, but it doesn't work dynamicaly and only with fixed values "true" and "false", so I think that I'm missing something somewhere.
I use want to trigger error display only when the form have been send at least once, thus when the "action" value is different from empty string. With this code I don't get any error messages :-(.
And there are some things that i find a little weird, maybe because i'm not really familliar with xsl :
- when declaring xxforms namespace in this form, the "xxforms:valid" attribute for inputs is changed to "xxforms_1:valid", however it seems that it remains in the same namespace, does it comes from processor used to display xml ?
- at the end of my form, for debug purpose, I display current xforms instance, and except before first submission why
<xsl:copy-of select ="/*" />
<xsl:copy-of select ="document('oxf:instance')" />
do not return the same thing ? I get my valid item with its value from the first statement (thanks to xsl check), and xforms instance from the second.
check-valid.xml
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xu="http://www.xmldb.org/xupdate" >
<xsl:template match="/form"> <valid>
<xsl:value-of select="not(//@xxforms:valid = 'false')"/>
</valid>
</xsl:template>
</xsl:transform>
ask-name-form.xml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsl:version="2.0"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
>
<head>
<title>Hello XForm1</title>
</head>
<body>
<xforms:group
ref="/form"
xxforms:show-errors="{/form/action !=''}"
>
<p>
Please enter your first name:
<xforms:input ref="/form/first-name">
<xforms:alert>
First Name must contain only one or more alphabetical characters.
</xforms:alert>
</xforms:input>
<br/>
Please enter your last name:
<xforms:input ref="/form/last-name">
<xforms:alert>
Last Name must contain only one or more alphabetical characters.
</xforms:alert>
</xforms:input>
<xforms:submit>
<xforms:label>Next >></xforms:label>
<xforms:setvalue ref="/form/action">next</xforms:setvalue>
</xforms:submit>
</p>
</xforms:group>
<p>
<f:xml-source xmlns:f="http://orbeon.org/oxf/xml/formatting">
<xsl:copy-of select ="/*" />
<xsl:copy-of select ="document('oxf:instance')" />
</f:xml-source >
</p> </body>
</html>
xforms-model.xml
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms" > <xforms:instance> <form> <first-name/> <last-name/> <action/> </form> </xforms:instance> <xforms:submission method="post" />
<!-- data constraints -->
<xforms:bind nodeset="/form/first-name"
constraint="matches(.,'[a-z]{1,}')"
/>
<xforms:bind nodeset="/form/last-name"
constraint="matches(.,'[A-Z]{1,}')"
/>
</xforms:model>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
orbeon-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/orbeon-user
