Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This document contains a ton of problems unfortunately, I'll go through each of them in turn.</p> <p>1) The biggest problem occurs a few times and seems to stem from some confusion between the <code>model</code> and the UI. The two are entirely separate beasts in XForms, which adheres to the model-view-controller design pattern. So you need to remember that everything in the <code>model</code> is entirely separate from everything in the UI. The relationship between the two is simply that UI controls may bind to instance data nodes in your <code>model</code>s. Practically, in terms of your document, this means that your <code>select1</code> and <code>repeat</code> elements should not be children of <code>model</code> elements. Only <code>instance</code>, <code>bind</code> and the action elements may be children of <code>model</code>.</p> <p>2) You are using multiple <code>model</code> elements, which is unnecessary in such a simple form (because each <code>model</code> may contain many <code>instance</code>s and <code>bind</code>s). The reason I flag this is up is because you introduce a couple of potential pitfalls by using multiple <code>model</code>s, which are best avoided by sticking to one <code>model</code> where possible. For example, the <code>instance</code> XPath function will not work across <code>model</code>s, so you have to be very careful about data dependencies between them. Also, a UI control is refreshed according to which <code>model</code> it is bound to, which has often caused me problems in the past when controls are apparently not refreshing sanely.</p> <p>3) You've tried to use a <code>repeat</code> element to apply a child <code>bind</code> to many nodes. This is wrong because <code>repeat</code> is a UI element, not a model element. However, since <code>bind</code> takes a <code>nodeset</code> attribute instead of a <code>ref</code> attribute, you don't actually need a <code>repeat</code> at all. Instead, you can just do this:</p> <pre><code>&lt;xf:bind nodeset="//want" readonly="true()" /&gt; </code></pre> <p>4) On many of your UI controls, you are specifying both a bind attribute and a ref attribute. These attributes are mutually exclusive, since they represent different ways to achieve the same thing. The ref attribute should contain XPath that identifies an instance data node that you want to bind the UI control to. The bind attribute should contain the id of a bind element that has been defined elsewhere (the bind element itself will identify the node that the control binds to in this case, via its nodeset attribute). So by using both attributes on the same UI control, you are contradicting yourself.</p> <p>5) In some places, you've attempted to use a ref attribute to bind a control to another element in the UI. Controls may only be bound to instance data.</p> <p>6) You have a <code>setvalue</code> inside a <code>repeat</code>, which you are attempting to invoke on the <code>xforms-value-changed</code> event. This event is not dispatched to the <code>repeat</code> element, so your <code>setvalue</code> will never be invoked. The <code>xforms-value-changed</code> event is only dispatched to the core form controls, which are <a href="http://www.w3.org/TR/xforms11/#elems-form-controls" rel="nofollow noreferrer">defined</a> in the <a href="http://www.w3.org/TR/xforms11/" rel="nofollow noreferrer">XForms spec</a> as:</p> <p>input|secret|textarea|output|upload|range|trigger|submit|select|select1</p> <p>7) Another answer to this question mentions that you are wrong to put your <code>model</code> elements in the document body. Unfortunately I don't have enough reputation to comment there, but I just wanted to point out that answer is actually wrong. Although it has become conventional to put the <code>model</code> elements in the document <code>head</code>, nothing in the XForms spec mandates this. In fact, one major XForms processor, <a href="http://ubiquity-xforms.googlecode.com/" rel="nofollow noreferrer">Ubiquity XForms</a>, actually requires <code>model</code>s to be in the document <code>body</code>, because of browser limitations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload