Skip to content

Instantly share code, notes, and snippets.

@ebruchez
Created July 28, 2022 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebruchez/a89f803ba5224363fc3914ea98a79862 to your computer and use it in GitHub Desktop.
Save ebruchez/a89f803ba5224363fc3914ea98a79862 to your computer and use it in GitHub Desktop.
Self calculated value does not update #5387
<xh:html xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms">
<xh:head>
<xh:title>Self calculated value does not update #5387</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<grid-1>
<dateTime/>
<control-4/>
</grid-1>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1">
<xf:bind id="dateTime-bind" ref="dateTime" name="dateTime" type="xf:dateTime"
calculate="if (string(.) castable as xs:dateTime) then&#xA; let $s := xf:seconds-from-dateTime((string(.))),&#xA; $c := 15 * 60&#xA; return&#xA; adjust-dateTime-to-timezone(&#xA; adjust-dateTime-to-timezone(&#xA; xf:seconds-to-dateTime(&#xA; ($s + (($c idiv 2) - 1)) idiv $c * $c&#xA; )&#xA; ),&#xA; ()&#xA; )&#xA;else&#xA; ."
readonly="false()"/>
<xf:bind id="control-4-bind" ref="control-4" name="control-4" xxf:whitespace="trim"
calculate="$dateTime"
readonly="false()"/>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>issue</application-name>
<form-name>5387</form-name>
<title xml:lang="en">Self calculated value does not update #5387</title>
<description xml:lang="en"/>
<created-with-version>2021.1.3.202204271907 PE</created-with-version>
<library-versions>
<orbeon>3</orbeon>
</library-versions>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<dateTime>
<label>wefewf</label>
<hint/>
</dateTime>
<control-4>
<label>dateTime as tring</label>
<hint/>
</control-4>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid" bind="grid-1-bind">
<fr:c x="1" y="1" w="6">
<fr:datetime xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="dateTime-control"
bind="dateTime-bind">
<xf:label ref="$form-resources/dateTime/label"/>
<xf:hint ref="$form-resources/dateTime/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:datetime>
</fr:c>
<fr:c x="7" y="1" w="6">
</fr:c>
<fr:c x="1" y="2" w="6">
<xf:input id="control-4-control" bind="control-4-bind">
<xf:label ref="$form-resources/control-4/label"/>
<xf:hint ref="$form-resources/control-4/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
<fr:c x="7" y="2" w="6"/>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment