In porting some old hand crafted forms from 3.9 to 4.10 I've noticed that you can have active controls in the form runner.
The case I've seen in a few of our old forms is where there is a list of items in the model <assistants type="List"> <assistant> <name type="String" /> </assistant> </assistants> and then some xform code to display existing entries with a delete button and an empty input field with a button to add a new entry to the list. <xforms:repeat nodeset="instance('fr-form-instance')/operationRecord/assistants/assistant[position() < last()]" id="assistantsRepeat"> <xhtml:tr> <xhtml:td> <xforms:input ref="name"> </xforms:input> </xhtml:td> <xhtml:td> <xforms:trigger> <xforms:label>Delete</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:delete nodeset="instance('fr-form-instance')/operationRecord/assistants/assistant" at="index('assistantsRepeat')" /> </xforms:action> </xforms:trigger> </xhtml:td> </xhtml:tr> </xforms:repeat> <xhtml:tr> <xhtml:td /> <xhtml:td align="right"> <xforms:trigger> <xforms:label>Insert</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:insert nodeset="instance('fr-form-instance')/operationRecord/assistants/assistant" at="last()" position="after" /> </xforms:action> </xforms:trigger> </xhtml:td> </xhtml:tr> Note that the trigger's are not bound to a model. When this form is displayed both the add and delete buttons are active and work, adding new entries to the list (which are themselves readonly) or deleting existing entries from the list. There is no way to save these changes so the form is not so much dangerous as just a bit confusing. In version 3.9 the triggers did not display in the form runner. this can easily be reproduced in 4.10 with the builder by creating a form with a button and then editing the source and removing the "bind=" attribute from the trigger. Is this expected behaviour? It seems a bit strange to me. For our porting purposes I'm just adding refs to the triggers if they don't have a ref/nodeset/bind already, i.e. <xforms:trigger>...</xforms:trigger> becomes <xforms:trigger ref="instance('fr-form-instance')">...</xforms:trigger> Is this the best fix (apart from re-writing the forms)? I can incorporate this into an xsl script I'm writing to do a bulk update of our customer's existing templates (we have 100's of them). brian... |
Administrator
|
Hi Brian,
Yes, the form is "live" in Form Builder, and only differs from what you have at runtime for practical reasons, i.e. it wouldn't make sense to hide non-relevant controls, or show validation errors. Now, from your description, I'm not following what you find strange. Maybe a sample form that I can run, steps to reproduce, and some screenshots would help? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Not "live in the form builder" rather it is live in the form runner when viewing a form.
If I create a new form using the template below and then view it using the url http://localhost:8080/orbeon/fr/CPF/bwtest2/view/201602171 the "Delete" and "Insert" buttons are still active. I would have thought that viewing a form via the view URL would not present something to the use that they can change. <xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:saxon="http://saxon.sf.net/" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fb="http://orbeon.org/oxf/xml/form-builder"> <xh:head> <xh:title>Untitled Form</xh:title> <xf:model id="fr-form-model" xxf:expose-xpath-types="true"> <!-- Main instance --> <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all"> <form> <assistants type="List"> <assistant> <name type="String" /> </assistant> </assistants> </form> </xf:instance> <!-- Metadata --> <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all"> <metadata> <application-name>CPF</application-name> <form-name>bwtest2</form-name> <title xml:lang="en">Untitled Form</title> <description xml:lang="en" /> <singleton /> </metadata> </xf:instance> </xf:model> </xh:head> <xh:body> <fr:view> <fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:p="http://www.orbeon.com/oxf/pipeline"> <fr:section id="section-1-control"> <fr:grid> <xf:repeat nodeset="instance('fr-form-instance')/assistants/assistant[position() < last()]" id="assistantsRepeat"> <xh:tr> <xh:td> <xf:input ref="name"> </xf:input> </xh:td> <xh:td> <xf:trigger> <xf:label>Delete</xf:label> <xf:action ev:event="DOMActivate"> <xf:delete nodeset="instance('fr-form-instance')/assistants/assistant" at="index('assistantsRepeat')" /> </xf:action> </xf:trigger> </xh:td> </xh:tr> </xf:repeat> <xh:tr> <xh:td /> <xh:td align="right"> <xf:trigger> <xf:label>Insert</xf:label> <xf:action ev:event="DOMActivate"> <xf:insert nodeset="instance('fr-form-instance')/assistants/assistant" at="last()" position="after" /> </xf:action> </xf:trigger> </xh:td> </xh:tr> </fr:grid> </fr:section> </fr:body> </fr:view> </xh:body> </xh:html> |
Administrator
|
Hi Brian,
Got it! When you're in view mode, the "static readonly" mode is used (see link below), and button should just be hidden, which is the case for buttons you create with Form Builder. Your buttons still show because they are not bound to anything, and thus are not readonly. You should be able to solve this problem by just binding them to a node of your instance. http://doc.orbeon.com/xforms/binds.html#static-appearance-for-readonly-controls Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |