Created
March 19, 2010 03:25
-
-
Save avernet/337197 to your computer and use it in GitHub Desktop.
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
<!-- | |
Copyright (C) 2009 Orbeon, Inc. | |
This program is free software; you can redistribute it and/or modify it under the terms of the | |
GNU Lesser General Public License as published by the Free Software Foundation; either version | |
2.1 of the License, or (at your option) any later version. | |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
See the GNU Lesser General Public License for more details. | |
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html | |
--> | |
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" | |
xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
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:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" | |
xmlns:xbl="http://www.w3.org/ns/xbl" | |
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> | |
<xhtml:head> | |
<xhtml:title>XForms Controls</xhtml:title> | |
<xhtml:link type="text/css" rel="stylesheet" href="/ops/yui/logger/assets/logger.css"/> | |
<xhtml:script type="text/javascript" src="/ops/yui/logger/logger.js"/> | |
<xhtml:script type="text/javascript" src="/ops/yui/yuitest/yuitest.js"/> | |
<!-- <xhtml:script type="text/javascript" src="/apps/xforms-sandbox/samples/test-update-full.js"/> --> | |
<xforms:model xxforms:xhtml-layout="span" xxforms:ajax.update.full.threshold="0"> | |
<xforms:instance id="ui"> | |
<ui> | |
<show-one>true</show-one> | |
<show-two>true</show-two> | |
<case-value>1</case-value> | |
<first-input>First</first-input> | |
<second-input>Second</second-input> | |
<focus-value>1</focus-value> | |
</ui> | |
</xforms:instance> | |
<xforms:instance id="numbers"> | |
<numbers> | |
<number value="1">One</number> | |
<number value="2">Two</number> | |
<number value="3">Three</number> | |
</numbers> | |
</xforms:instance> | |
</xforms:model> | |
<xhtml:style type="text/css"> | |
.xforms-repeat-selected-item-1 { background-color: transparent } | |
</xhtml:style> | |
</xhtml:head> | |
<xhtml:body> | |
<!-- <xhtml:h2>xxforms:update="full" on group around tr</xhtml:h2> | |
<xhtml:div> | |
<xforms:trigger id="toggle-two"> | |
<xforms:label>Toggle two</xforms:label> | |
<xforms:setvalue ev:event="DOMActivate" ref="instance('ui')/show-two" value="if (. = 'true') then 'false' else 'true'"/> | |
</xforms:trigger> | |
</xhtml:div> | |
<xhtml:div> | |
<xhtml:table> | |
<xforms:repeat nodeset="instance('numbers')/number"> | |
<xxforms:variable name="position" select="position()"/> | |
<xforms:group ref=".[@value != 2 or instance('ui')/show-two = 'true']" xxforms:update="full" id="group-update-full"> | |
<xhtml:tr> | |
<xhtml:td> | |
<xforms:output value="." id="number"/> | |
</xhtml:td> | |
<xhtml:td> | |
<xforms:input id="field" ref="."> | |
<xforms:setvalue ev:event="DOMFocusIn" ref="instance('ui')/show-two" value="if (. = 'true') then 'false' else 'true'"/> | |
</xforms:input> | |
</xhtml:td> | |
</xhtml:tr> | |
</xforms:group> | |
</xforms:repeat> | |
</xhtml:table> | |
</xhtml:div> --> | |
<xhtml:h2>xxforms:update="full" on case</xhtml:h2> | |
<xhtml:div> | |
<xforms:trigger id="increment-case-value"> | |
<xforms:label>Increment case value</xforms:label> | |
<xforms:setvalue ev:event="DOMActivate" ref="case-value" value=". + 1"/> | |
</xforms:trigger> | |
</xhtml:div> | |
<xhtml:div> | |
<fr:databound-switch ref="instance('ui')/show-one"> | |
<xforms:case id="true"> | |
<xforms:group xxforms:update="full"> | |
<xforms:output value="instance('ui')/case-value" id="case-value-in-xbl"/> | |
</xforms:group> | |
</xforms:case> | |
</fr:databound-switch> | |
</xhtml:div> | |
<xforms:group xxforms:update="full"> | |
<xforms:output value="instance('ui')/case-value" id="case-value-not-in-xbl"/> | |
</xforms:group> | |
<!-- <xhtml:h2>xxforms:update="full" on repeat</xhtml:h2> | |
<xhtml:div> | |
<xforms:trigger id="toggle-one"> | |
<xforms:label>Show one</xforms:label> | |
<xforms:setvalue ev:event="DOMActivate" ref="show-one" value="if (. = 'true') then 'false' else 'true'"/> | |
</xforms:trigger> | |
</xhtml:div> | |
<xhtml:div> | |
<xforms:repeat nodeset="instance('numbers')/number[if (instance('ui')/show-one = 'false') then @value != 1 else true()]" xxforms:update="full" id="repeat-update-full"> | |
<xforms:output value="." id="repeat-value"/> | |
</xforms:repeat> | |
</xhtml:div> | |
<xhtml:h2>Restoring the focus</xhtml:h2> | |
<xforms:group xxforms:update="full"> | |
<xforms:setvalue ev:event="DOMFocusIn" ref="focus-value" value=". + 1"/> | |
<xforms:output value="focus-value"/> | |
<xforms:input id="first-input" ref="first-input"/> | |
<xforms:input id="second-input" ref="second-input[../focus-value != 3]"/> | |
</xforms:group> --> | |
</xhtml:body> | |
</xhtml:html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment