Skip to content

Instantly share code, notes, and snippets.

@binnyg
Created January 6, 2011 15:44
Show Gist options
  • Save binnyg/768034 to your computer and use it in GitHub Desktop.
Save binnyg/768034 to your computer and use it in GitHub Desktop.
relevant-toggle-error.xhtml
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<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>
<relevant1>true</relevant1>
<title/>
</root>
</xforms:instance>
<xforms:bind nodeset="instance('instance')">
<xforms:bind nodeset="title" relevant="../relevant1 = true()" />
<xforms:bind nodeset="relevant1" type="xforms:boolean" />
</xforms:bind>
</xforms:model>
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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"/>
<xsl:copy-of select="xxbl:parameter(., 'max')"/>
<xxforms:script ev:event="xforms-enabled" ev:target="#observer">
alert('inside');
YAHOO.xbl.fr.InputCounted.instance(this).init();
</xxforms:script>
<xforms:group xxbl:scope="inner">
<xxforms:variable name="binding" as="node()?">
<xxforms:sequence select="." xxbl:scope="outer"/>
</xxforms:variable>
<xforms:input id="input-counted" class="fr-input-counted" ref="$binding"
incremental="true"/>
<label class="counter-label"></label>
</xforms:group>
</xforms:group>
</xsl:template>
</xsl:transform>
</xbl:template>
</xbl:binding>
</xbl:xbl>
<xhtml:script type="text/javascript">
<![CDATA[
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 = {
init: function() {
alert('initialized');
}
};
]]>
</xhtml:script>
</xhtml:head>
<xhtml:body class="body">
<div>
<xforms:input ref="relevant1">
<xforms:label>Make input relevant</xforms:label>
</xforms:input>
</div>
<div>
<fr:input-counted ref="title" max="10">
<xforms:label>Node Selector</xforms:label>
</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