Hi Damon,

This was intended to be a feature, but since it is both not documented and quite unexpected, I understand it might look more like a bug.

This behavior was implemented a few months back so it would be easier to create UIs with repeating values. Consider this example: we want multiple text fields on a page and we want to be able to dynamically a text fields without having to change the XForms model. With the current implementation of OXF, you can have XForms model with just:

<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms";>
    <xforms:instance>
        <form>
            <emp/>
        </form>
    </xforms:instance>
</xforms:model>

Then in the view, you can have multiple XForms controls reference the "same" element /form/emp. Those controls could be dynamically generated with an XSLT stylesheet in the view:

<d:p><xforms:input ref="/form/emp"/></d:p>
<d:p><xforms:input ref="/form/emp"/></d:p>
<d:p><xforms:input ref="/form/emp"/></d:p>

When the user fills the form with 3 values "Tom", "Mark", and "John", the instance created by the XForms Input processor will be:

<form>
    <emp>Tom</emp>
    <emp>Mark</emp>
    <emp>John</emp>
</form>

This system works pretty well when just one control is repeated. But it has at least two major drawbacks:

1) It cannot handle appropriately more complex cases with multiple controls where we would like the generated instance to look like:

<form>
    <emp>
        <firstname>Tom</firstname>
        <lastname>Smith</lastname>
    </emp>
    <emp>
        <firstname>Mark</firstname>
        <lastname>Jackson</lastname>
    </emp>
    ...
</form>

2) It prevents the same value from the instance to be inserted multiple times in the view (as the second ref="x" will look for the second node in the nodeset returned from the evaluation of the XPath expression "x" on the instance).

My advice at this point is not to use this undocumented "feature" as the plan is remove it soon in favor of the <xforms:repeat>, as discussed earlier on this mailing list.

Alex


Damon Rand wrote:


Hi,
  I have found a bug in xforms in beta 2.0..

Modify counter/view.xml as follows.. I can't call <xforms:output> twice for the same value..

Damon.

<d:document xmlns:d="http://orbeon.org/oxf/xml/document";
    xmlns:xforms="http://www.w3.org/2002/01/xforms";
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms";>

    <d:head><d:title>OXF Example - Counter</d:title></d:head>
    <d:body>
        <xforms:group ref="instance">
            <d:h1>Counter</d:h1>
            <d:p>The current value is: <xforms:output ref="counter"/>.</d:p>
            <d:p>The second current value doesnt appear!!!!!!: <xforms:output 
ref="counter"/>.</d:p>
_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users


_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users

Reply via email to