Created
June 8, 2011 02:31
-
-
Save binnyg/1013671 to your computer and use it in GitHub Desktop.
relevant-without-repeat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YDOM = YAHOO.util.Dom; | |
var ODOC = ORBEON.xforms.Document; | |
YAHOO.namespace("xbl.fr"); | |
YAHOO.xbl.fr.InputCounted = function() {}; | |
ORBEON.xforms.XBL.declareClass(YAHOO.xbl.fr.InputCounted, "xbl-fr-input-counted"); | |
YAHOO.xbl.fr.InputCounted.prototype = { | |
destroy: function() { | |
alert('destroy'); | |
}, | |
init: function() { | |
alert('init'); | |
}, | |
initialize: function() { | |
alert('initialize'); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" | |
xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:widget="http://orbeon.org/oxf/xml/widget" | |
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" | |
xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<xhtml:head> | |
<xforms:model id="main" | |
xxforms:session-heartbeat="true" | |
xxforms:show-error-dialog="false" | |
xxforms:external-events="submit-save submit-preview submit-cancel"> | |
<xforms:instance id="instance"> | |
<root> | |
</root> | |
</xforms:instance> | |
<xforms:instance id="proto-toolbox"> | |
<repeat> | |
<title /> | |
<enable /> | |
</repeat> | |
</xforms:instance> | |
<xforms:bind nodeset="repeat/title" required="true()" relevant="../enable = 'true'" /> | |
<xforms:bind nodeset="repeat/enable" type="xs:boolean" /> | |
</xforms:model> | |
<xbl:xbl> | |
<xbl:script src="/apps/xforms-sandbox/samples/relevant-error.js" /> | |
<xbl:binding id="fr-input-counted" element="fr|input-counted"> | |
<xbl:template xxbl:transform="oxf:unsafe-xslt"> | |
<xsl:transform version="2.0"> | |
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl" /> | |
<xsl:template match="/*"> | |
<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer"> | |
<xbl:content includes="xforms|label, xforms|alert" /> | |
<xxforms:script ev:event="xforms-enabled" ev:target="#observer"> | |
YAHOO.xbl.fr.InputCounted.instance(this).initialize(); | |
</xxforms:script> | |
<xxforms:script ev:event="xforms-disabled" ev:target="#observer"> | |
YAHOO.xbl.fr.InputCounted.instance(this).destroy(); | |
</xxforms:script> | |
<xforms:input id="input-counted" class="fr-input-counted" ref="." incremental="true"> | |
<label class="counter-label">label</label> | |
</xforms:input> | |
</xforms:group> | |
</xsl:template> | |
</xsl:transform> | |
</xbl:template> | |
</xbl:binding> | |
</xbl:xbl> | |
<xbl:xbl> | |
<xbl:binding id="fr-repeated-group" element="fr|repeated-group"> | |
<xbl:template xxbl:transform="oxf:unsafe-xslt"> | |
<xsl:transform version="2.0"> | |
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl"/> | |
<xsl:template match="/*"> | |
<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer"> | |
<xsl:variable name="label" as="xs:string" select="./xforms:label"/> | |
<div> | |
<xforms:trigger appearance="full"> | |
<xforms:label> | |
Add Another | |
</xforms:label> | |
<xforms:insert ev:event="DOMActivate" | |
nodeset="{/*/@nodeset}" | |
origin="{/*/@origin}" | |
context="{/*/@context}" /> | |
</xforms:trigger> | |
</div> | |
<xforms:repeat nodeset="{/*/@nodeset}"> | |
<xforms:group> | |
<xsl:copy-of select="*/*"/> | |
</xforms:group> | |
</xforms:repeat> | |
</xforms:group> | |
</xsl:template> | |
</xsl:transform> | |
</xbl:template> | |
</xbl:binding> | |
</xbl:xbl> | |
</xhtml:head> | |
<xhtml:body class="body"> | |
<fr:repeated-group | |
id="toolbox" | |
groupName="Component" | |
nodeset="repeat" | |
origin="instance('proto-toolbox')" | |
context="instance()"> | |
<div> | |
<xforms:input ref="enable" max="10"> | |
<xforms:label>Enable</xforms:label> | |
</xforms:input> | |
</div> | |
<div> | |
<fr:input-counted ref="title" max="10"> | |
<xforms:label>Title </xforms:label> | |
<xforms:alert>Title is required </xforms:alert> | |
</fr:input-counted> | |
</div> | |
</fr:repeated-group> | |
</xhtml:body> | |
</xhtml:html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" | |
xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:widget="http://orbeon.org/oxf/xml/widget" | |
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" | |
xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<xhtml:head> | |
<xforms:model id="main" | |
xxforms:session-heartbeat="true" | |
xxforms:show-error-dialog="false" | |
xxforms:external-events="submit-save submit-preview submit-cancel"> | |
<xforms:instance id="instance"> | |
<root> | |
<title /> | |
<enable /> | |
</root> | |
</xforms:instance> | |
<xforms:bind nodeset="title" required="true()" relevant="../enable = 'true'" /> | |
<xforms:bind nodeset="enable" type="xs:boolean" /> | |
</xforms:model> | |
<xbl:xbl> | |
<xbl:script src="/apps/xforms-sandbox/samples/relevant-error.js" /> | |
<xbl:binding id="fr-input-counted" element="fr|input-counted"> | |
<xbl:template xxbl:transform="oxf:unsafe-xslt"> | |
<xsl:transform version="2.0"> | |
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl" /> | |
<xsl:template match="/*"> | |
<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer"> | |
<xbl:content includes="xforms|label, xforms|alert" /> | |
<xxforms:script ev:event="xforms-enabled" ev:target="#observer"> | |
YAHOO.xbl.fr.InputCounted.instance(this).initialize(); | |
</xxforms:script> | |
<xxforms:script ev:event="xforms-disabled" ev:target="#observer"> | |
YAHOO.xbl.fr.InputCounted.instance(this).destroy(); | |
</xxforms:script> | |
<xforms:input id="input-counted" class="fr-input-counted" ref="." incremental="true"> | |
<label class="counter-label">label</label> | |
</xforms:input> | |
</xforms:group> | |
</xsl:template> | |
</xsl:transform> | |
</xbl:template> | |
</xbl:binding> | |
</xbl:xbl> | |
</xhtml:head> | |
<xhtml:body class="body"> | |
<div> | |
<xforms:input ref="enable" max="10"> | |
<xforms:label>Enable</xforms:label> | |
</xforms:input> | |
</div> | |
<div> | |
<fr:input-counted ref="title" max="10"> | |
<xforms:label>Title </xforms:label> | |
<xforms:alert>Title is required </xforms:alert> | |
</fr:input-counted> | |
</div> | |
</xhtml:body> | |
</xhtml:html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment