xbl component conversion from 3.9 to 4.8

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

xbl component conversion from 3.9 to 4.8

bwallis42
I'm trying to convert an old control we have been using in 3.9. I'm failing to get it to work. The 3.9 version source is shown below as is my current 4.8 version. The 3.9 version loads and works in 3.9. I get an error when using it in 4.8.1.

|No namespace declaration found for prefix: xforms                                                                     |

but I haven't managed to track that down.

When the control is inserted in the builder (in 3.9) you see the following (title is "drop down" and a hint of "hint")

3.9 version in builder

On testing the form you see:

3.9 version in test

and clicking add shows this

3.9 version in test after add

So, all it does is let you add to and delete from a list of text box items.


My new version loads but doesn't quite work. Two things seems to be going wrong

1) the "add" button is displayed in the form builder which suggests it is treating the control as readwrite, not readonly.

2) in test (and in the builder) as soon as I click "Add" to add an item to the list the list disappears (no item, no add button, the label and hint also disappear) which suggests that it isn't correctly iterating through the model. Using the xforms inspector shows that a new item is added into the model.

3.9 version source is:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    CPF Aware Controls.
    
    Copyright (C) 2010 InfoMedix.
    
-->
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml"
         xmlns:xforms="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         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:xxforms="http://orbeon.org/oxf/xml/xforms"
         xmlns:exforms="http://www.exforms.org/exf/1-0"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:im="http://www.infomedix.com.au/cpf/forms"
         xmlns:xbl="http://www.w3.org/ns/xbl"
         xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
    
    <!--
        DYNAMIC LIST
        
        A list of items that can be extended or shortened by the user.  This control consists of a column of entry
        boxes, each with an associated "Delete" trigger.  The user can change the value of any of the entry boxes or
        remove an entry by clicking the "Delete" trigger.  The user can also append new entry boxes by clicking an
        "Add" trigger which appears below the last entry box.
        
        The default schema this control works with (assuming the control is bound to '<boundnode>') is:
        
            <boundnode>
                <item>entry1</item>
                <item>entry2</item>
                ...
            </boundnode>
        
        with new item nodes appearing at the bottom of the list of items.
        
        The control supports two attributes which can be used to adjust the expected schema that the control is bound
        to.  The attribute 'item-node-name' is used to set the name of the node which stores the data of one entry box.
        If this node is not present, the value is set to "item".  Using the above example, setting this attribute to
        "testnode" will result in the following schema:
        
            <boundnode>
                <testnode>entry1</testnode>
                <testnode>entry2</testnode>
                ...
            </boundnode>
        
        The attribute 'item-node-wrapper', when set to an non-empty string value, defines a node which wraps the item
        node.  This is so that the control can be used in v2.5 forms.  Using the first example, setting the attribute to
        "wrapper" will result in the following schema:
        
            <boundnode>
                <wrapper>
                    <item>entry1</item>
                </wrapper>
                <wrapper>
                    <item>entry2</item>
                </wrapper>
                ...
            </boundnode>  
        
     -->
    <xbl:binding id="im-dynamic-list" element="im|dynamic-list">
        <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
            <display-name lang="en">Dynamic List</display-name>
            <display-name lang="fr">Dynamic List</display-name>
            <icon lang="en">
                <small-icon>/forms/orbeon/builder/images/listbox.png</small-icon>
                <large-icon>/forms/orbeon/builder/images/listbox.png</large-icon>
            </icon>
            <datatype>xforms:string</datatype>
            <template>
                <im:dynamic-list id="" ref="" xmlns="">
                    <xforms:label ref=""/>
                    <xforms:hint ref=""/>
                    <xforms:help ref=""/>
                    <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                </im:dynamic-list>
            </template>
        </metadata>
        <xbl:resources>
            <xbl:style src="/xbl/im/dynamic-list/dynamic-list.css"/>
        </xbl:resources>   
        <xbl:template>

            <!-- Outer group implementing the single-node binding -->
            <xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">
                <!-- Copy LHHA elements if any -->
                <xbl:content includes="xforms|label,xforms|help,xforms|hint,xforms|alert"/>
                                
                <!-- Inner group -->
                <xforms:group id="component-group" xxbl:scope="inner">
                
                    <!-- Instance binding -->
<!--                    <xxforms:variable name="binding" select="." as="node()?"/>-->
                    <xxforms:variable name="binding" as="node()?">
                        <xxforms:sequence select="." xxbl:scope="outer"/>
                    </xxforms:variable>

                        <!-- Model attributes -->
                        <xxforms:variable name="attr-item-node-name" xbl:attr="xbl:text=item-node-name"/>
                        <xxforms:variable name="attr-item-node-wrapper" xbl:attr="xbl:text=item-node-wrapper"/>
                         
                        <xxforms:variable name="item-node-name" select="if (string-length($attr-item-node-wrapper) != 0) then ($attr-item-node-wrapper) else (if (string-length($attr-item-node-name) != 0) then ($attr-item-node-name) else ('item'))"/>
                        <xxforms:variable name="subitem-node-name" select="if (string-length($attr-item-node-wrapper) != 0) then ($attr-item-node-name) else ('')"/>  
                    
                
                    <xforms:switch>
                        <xforms:case id="editable" selected="true">
                            <xforms:repeat nodeset="$binding/*[name() = $item-node-name]">
                                <xxforms:variable name="item-contents-node" select="if ($subitem-node-name = '') then (.) else (./*[name() = $subitem-node-name and position() = 1])"/>
                                
                                        <xhtml:div>
                                            <xhtml:div class="xbl-im-dynamic-list-rw-input-div">
                                                        <xforms:input ref="$item-contents-node">
                                                            <xforms:label/>
                                                </xforms:input>
                                            </xhtml:div>
                                            <xhtml:div class="xbl-im-dynamic-list-rw-btn-div">
                                                    <xforms:trigger>
                                                        <xforms:label>Delete</xforms:label>
                                                        <xforms:delete nodeset="." ev:event="DOMActivate"/>
                                                    </xforms:trigger>
                                            </xhtml:div>
                                    </xhtml:div>
                            </xforms:repeat>
                            <xforms:trigger>
                                <xforms:label>Add</xforms:label>
                                
                                <xforms:action ev:event="DOMActivate">
                                    <xforms:action if="$subitem-node-name = ''">
                                        <xforms:insert context="$binding" nodeset="*[name() = $item-node-name]" origin="xxforms:element($item-node-name)"/>
                                    </xforms:action>              
                                    <xforms:action if="$subitem-node-name != ''">
                                        <xforms:insert context="$binding" nodeset="*[name() = $item-node-name]" origin="xxforms:element($item-node-name, xxforms:element($subitem-node-name))"/>
                                    </xforms:action>              
                                </xforms:action>                                                            
                            </xforms:trigger>                               
                        </xforms:case>
                        <xforms:case id="not-editable">
                            <xforms:repeat nodeset="$binding/*[name() = $item-node-name]">
                                <xxforms:variable name="item-contents-node" select="if ($subitem-node-name = '') then (.) else (./*[name() = $subitem-node-name and position() = 1])"/>
                                
                                <xforms:input ref="$item-contents-node">
                                    <xforms:label/>
                                </xforms:input>
                            </xforms:repeat>
                        </xforms:case>
                    </xforms:switch>
                    
                    <!-- Initialisation code -->                    
                    <xforms:action ev:event="xforms-enabled" ev:observer="component-group">
                        <xforms:toggle case="not-editable" if="exforms:readonly($binding)"/>
                    </xforms:action>
                    
                    <xforms:toggle case="not-editable" ev:event="xforms-readonly"/>
                    <xforms:toggle case="editable" ev:event="xforms-readwrite"/>                    
                </xforms:group>                
            </xforms:group>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

and my ported source to 4.8 is:

<?xml version="1.0" encoding="UTF-8"?>
<!--
    CPF Aware Controls.
    
    Copyright (C) 2010 InfoMedix.
    
-->
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:saxon="http://saxon.sf.net/"
    xmlns:im="http://www.infomedix.com.au/cpf/forms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
    
    <!--
        DYNAMIC LIST
        
        A list of items that can be extended or shortened by the user.  This control consists of a column of entry
        boxes, each with an associated "Delete" trigger.  The user can change the value of any of the entry boxes or
        remove an entry by clicking the "Delete" trigger.  The user can also append new entry boxes by clicking an
        "Add" trigger which appears below the last entry box.
        
        The default schema this control works with (assuming the control is bound to '<boundnode>') is:
        
            <boundnode>
                <item>entry1</item>
                <item>entry2</item>
                ...
            </boundnode>
        
        with new item nodes appearing at the bottom of the list of items.
        
        The control supports two attributes which can be used to adjust the expected schema that the control is bound
        to.  The attribute 'item-node-name' is used to set the name of the node which stores the data of one entry box.
        If this node is not present, the value is set to "item".  Using the above example, setting this attribute to
        "testnode" will result in the following schema:
        
            <boundnode>
                <testnode>entry1</testnode>
                <testnode>entry2</testnode>
                ...
            </boundnode>
        
        The attribute 'item-node-wrapper', when set to an non-empty string value, defines a node which wraps the item
        node.  This is so that the control can be used in v2.5 forms.  Using the first example, setting the attribute to
        "wrapper" will result in the following schema:
        
            <boundnode>
                <wrapper>
                    <item>entry1</item>
                </wrapper>
                <wrapper>
                    <item>entry2</item>
                </wrapper>
                ...
            </boundnode>  
        
     -->

    <fb:metadata>
        <fb:display-name lang="en">Custom Controls</fb:display-name>
    </fb:metadata>


    <xbl:binding id="im-dynamic-list" element="im|dynamic-list" xxbl:mode="lhha binding value">
        <fb:metadata>
            <fb:display-name lang="en">Dynamic List</fb:display-name>
            <fb:display-name lang="fr">Dynamic List</fb:display-name>
            <fb:icon lang="en">
                <fb:small-icon>/forms/orbeon/builder/images/listbox.png</fb:small-icon>
                <fb:large-icon>/forms/orbeon/builder/images/listbox.png</fb:large-icon>
            </fb:icon>
            <fb:datatype>xs:string</fb:datatype>
            <fb:template>
                <im:dynamic-list id="" ref="" xmlns="">
                    <xforms:label ref="" />
                    <xforms:hint ref="" />
                    <xforms:help ref="" />
                    <xforms:alert ref="$fr-resources/detail/labels/alert" />
                </im:dynamic-list>
            </fb:template>
        </fb:metadata>
        <xbl:resources>
            <xbl:style src="/xbl/im/dynamic-list/dynamic-list.css" />
        </xbl:resources>
        <xbl:template>
            <xforms:group id="im-component-group">
                
                    <!-- Model attributes -->
                <xxforms:variable name="attr-item-node-name" xbl:attr="xbl:text=item-node-name" />
                <xxforms:variable name="attr-item-node-wrapper" xbl:attr="xbl:text=item-node-wrapper" />

                <xxforms:variable name="item-node-name" select="if (string-length($attr-item-node-wrapper) != 0) then ($attr-item-node-wrapper) else (if (string-length($attr-item-node-name) != 0) then ($attr-item-node-name) else ('item'))" />
                <xxforms:variable name="subitem-node-name" select="if (string-length($attr-item-node-wrapper) != 0) then ($attr-item-node-name) else ('')" />
             
                <xxforms:variable name="binding" select="xxforms:binding('im-dynamic-list')"/>
                <xxforms:variable name="binding-context" select="xxforms:binding-context('im-dynamic-list')"/>

                <xforms:switch>
                    <xforms:case id="editable" selected="true">
                        <xforms:repeat nodeset="$binding/*[name() = $item-node-name]">
                            <xxforms:variable name="item-contents-node" select="if ($subitem-node-name = '') then (.) else (./*[name() = $subitem-node-name and position() = 1])" />
                            <xhtml:div>
                                <xhtml:div class="xbl-im-dynamic-list-rw-input-div">
                                    <xforms:input ref="$item-contents-node">
                                        <xforms:label />
                                    </xforms:input>
                                </xhtml:div>
                                <xhtml:div class="xbl-im-dynamic-list-rw-btn-div">
                                    <xforms:trigger>
                                        <xforms:label>Delete</xforms:label>
                                        <xforms:delete nodeset="." ev:event="DOMActivate" />
                                    </xforms:trigger>
                                </xhtml:div>
                            </xhtml:div>
                        </xforms:repeat>
                        <xforms:trigger>
                            <xforms:label>Add</xforms:label>
                            <xforms:action ev:event="DOMActivate">
                                <xforms:action if="$subitem-node-name = ''">
                                    <xforms:insert context="$binding" nodeset="*[name() = $item-node-name]" origin="xxforms:element($item-node-name)" />
                                    <xxforms:script>
                                        console.log("no sub item");
                                    </xxforms:script>
                                </xforms:action>
                                <xforms:action if="$subitem-node-name != ''">
                                    <xforms:insert context="$binding" nodeset="*[name() = $item-node-name]" origin="xxforms:element($item-node-name, xxforms:element($subitem-node-name))" />
                                    <xxforms:script>
                                        console.log("with sub item");
                                    </xxforms:script>
                                </xforms:action>
                            </xforms:action>
                        </xforms:trigger>
                    </xforms:case>
                    <xforms:case id="not-editable">
                        <xforms:repeat nodeset="$binding/*[name() = $item-node-name]">
                            <xxforms:variable name="item-contents-node" select="if ($subitem-node-name = '') then (.) else (./*[name() = $subitem-node-name and position() = 1])" />
                            <xforms:input ref="$item-contents-node">
                                <xforms:label />
                            </xforms:input>
                        </xforms:repeat>
                    </xforms:case>
                </xforms:switch>
                    
                    <!-- Initialisation code -->
                <xforms:action ev:event="xforms-enabled" ev:observer="im-component-group">
                    <xforms:toggle case="not-editable" if="exforms:readonly($binding)" />
                    <xforms:toggle case="editable" if="not(exforms:readonly($binding))" />
                    <xxforms:script ev:event="xforms-value-changed" if="exforms:readonly($binding)">
                        console.log("readonly");
                    </xxforms:script>
                    <xxforms:script ev:event="xforms-value-changed" if="not(exforms:readonly($binding))">
                        console.log("readwrite");
                    </xxforms:script>
                    <xxforms:script ev:event="xforms-value-changed">
                        console.log("component group = %o", this);
                        console.log("event = %o", event);
                    </xxforms:script>
                </xforms:action>
                <xforms:toggle case="not-editable" ev:event="xforms-readonly" />
                <xforms:toggle case="editable" ev:event="xforms-readwrite" />
            </xforms:group>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

Hank Ratzesberger-3
The namespaces have been shortened a bit.  Could be only that?
Changing xforms to xf ?

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:lb="http://www.liquibase.org/xml/ns/dbchangelog"
         xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext">

Regards,
Hank


On Mon, May 4, 2015 at 6:23 PM, bwallis42 <[hidden email]> wrote:

> I'm trying to convert an old control we have been using in 3.9. I'm failing
> to get it to work. The 3.9 version source is shown below as is my current
> 4.8 version. The 3.9 version loads and works in 3.9. I get an error when
> using it in 4.8.1.
>
> |No namespace declaration found for prefix: xforms
> |
>
> but I haven't managed to track that down.
>
> When the control is inserted in the builder (in 3.9) you see the following
> (title is "drop down" and a hint of "hint")
>
> <http://discuss.orbeon.com/file/n4659866/39inbuilder.jpg>
>
> On testing the form you see:
>
> <http://discuss.orbeon.com/file/n4659866/39intest-1.jpg>
>
> and clicking add shows this
>
> <http://discuss.orbeon.com/file/n4659866/39intest-2.jpg>
>
> So, all it does is let you add to and delete from a list of text box items.
>
>
> My new version loads but doesn't quite work. Two things seems to be going
> wrong
>
> 1) the "add" button is displayed in the form builder which suggests it is
> treating the control as readwrite, not readonly.
>
> 2) in test (and in the builder) as soon as I click "Add" to add an item to
> the list the list disappears (no item, no add button, the label and hint
> also disappear) which suggests that it isn't correctly iterating through the
> model. Using the xforms inspector shows that a new item is added into the
> model.
>
> 3.9 version source is:
>
>
> and my ported source to 4.8 is:
>
>
>
>
> --
> View this message in context: http://discuss.orbeon.com/xbl-component-conversion-from-3-9-to-4-8-tp4659866.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].



--
Hank Ratzesberger
XMLWerks.com

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

bwallis42
That original control xbl was working in 3.9 and I think is consistently using the xforms prefix for http://www.w3.org/2002/xforms. Whether or not the prefix used in other parts of orbeon is xf or xforms shouldn't  affect this control (I would hope), the namespace prefix used is a local setting as long as you are consistent.

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

Alessandro  Vernet
Administrator
Hi Brian,

True, you should be able to use xforms: instead of xf: if you'd like,
still, there might be a bug somewhere. So, could you try changing all
your prefixes and the corresponding namespace declaration to use xf:?
Is am wondering if there could be an issue related to the
<datatype>xforms:string</datatype>.

Alex

On Tue, May 5, 2015 at 4:36 AM, bwallis42 <[hidden email]> wrote:

> That original control xbl was working in 3.9 and I think is consistently
> using the xforms prefix for http://www.w3.org/2002/xforms. Whether or not
> the prefix used in other parts of orbeon is xf or xforms shouldn't  affect
> this control (I would hope), the namespace prefix used is a local setting as
> long as you are consistent.
>
> thanks.
>
>
> --
> View this message in context: http://discuss.orbeon.com/xbl-component-conversion-from-3-9-to-4-8-tp4659866p4659870.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

bwallis42
Alessandro Vernet wrote
Is am wondering if there could be an issue related to the
<datatype>xforms:string</datatype>.
I went back to the old version and just changed the datatype to xs:string (where xs is http://www.w3.org/2001/XMLSchema) which is what it should have been. For some reason this didn't cause an error in 3.9.

The control still doesn't work though. It gets inserted in the form but nothing displays. Will investigate further.
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

Alessandro  Vernet
Administrator
Hi Brian,

Got it; you'll let us know what you find, and if there is anything we
can do to help.

Alex

On Thu, May 7, 2015 at 4:50 AM, bwallis42 <[hidden email]> wrote:

> Alessandro  Vernet wrote
>> Is am wondering if there could be an issue related to the
>> <datatype>
>> xforms:string
>> </datatype>
>> .
>
> I went back to the old version and just changed the datatype to xs:string
> (where xs is http://www.w3.org/2001/XMLSchema) which is what it should have
> been. For some reason this didn't cause an error in 3.9.
>
> The control still doesn't work though. It gets inserted in the form but
> nothing displays. Will investigate further.
>
> --
> View this message in context: http://discuss.orbeon.com/xbl-component-conversion-from-3-9-to-4-8-tp4659866p4659885.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

bwallis42
I have a severely simplified version of my control (shown at the end).  I cannot see what is wrong with this. I have tried various alternative ways of doing the insert and repeat but always get the same result. It seems that as soon as there are elements in the model for this control, it disappears.

When you click the "Add" button it should add an element to the model, "<item/>", which should then be displayed as an input field so you can add text to this new entry in the list. You can then click "Add" again to add a second entry.

This isn't working. On the first click of "Add" a new "<item/> is added to the model (I can see that in the inspector) but then the whole component disappears. Using "Inspect" in the browser before and after clicking add shows that the HTML hasn't changed much but has an extra couple of classes added to the elements: xforms-disabled-subsequent and xforms-visited.

I've tried this on firefox and chrome and am running Orbeon 4.9 (same result on 4.8.1).

This is the HTML (for that component) after clicking add.

<div class="fr-grid-content">
    <div id="section-1-control≡xf-383≡control-3-control"
        class="fr-grid-1-2 xbl-component xbl-im-dynamic-list xforms-disabled-subsequent xforms-visited">
        <label class="xforms-label xforms-disabled-subsequent"></label>
        <span
            id="section-1-control≡xf-383≡control-3-control≡im-component-group"
            class="xforms-group xforms-disabled-subsequent xforms-visited">
            <div
                id="repeat-begin-section-1-control≡xf-383≡control-3-control≡xf-404"
                class="xforms-repeat-begin-end"></div>
            <div class="xforms-repeat-delimiter"></div> <span
            class="xforms-repeat-template"> </span>
            <div
                class="xbl-im-dynamic-list-rw-input-div xforms-repeat-template">
                <span
                    id="section-1-control≡xf-383≡control-3-control≡xf-405"
                    class="xforms-control xforms-input"> 
                    <input
                        id="section-1-control≡xf-383≡control-3-control≡xf-405≡xforms-input-1"
                        type="text"
                        name="section-1-control≡xf-383≡control-3-control≡xf-405≡xforms-input-1"
                        value="" class="xforms-input-input">
                </span>
            </div> <span class="xforms-repeat-template"> </span>
            <div
                id="repeat-end-section-1-control≡xf-383≡control-3-control≡xf-404"
                class="xforms-repeat-begin-end"></div> <span
            id="section-1-control≡xf-383≡control-3-control≡xf-406"
            class="xforms-control xforms-trigger xforms-trigger-appearance-full xforms-disabled-subsequent xforms-visited">
                <button
                    id="section-1-control≡xf-383≡control-3-control≡xf-406≡≡c"
                    type="button" class="btn"></button>
        </span>
        </span> <span class="xforms-alert xforms-disabled-subsequent"> </span>
        <span class="xforms-hint xforms-disabled-subsequent"> </span>
    </div>
</div>

The simplified component source is:

<?xml version="1.0" encoding="UTF-8"?>
<xbl:xbl xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 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:exforms="http://www.exforms.org/exf/1-0"
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
    xmlns:saxon="http://saxon.sf.net/" xmlns:im="http://www.infomedix.com.au/cpf/forms" xmlns:xbl="http://www.w3.org/ns/xbl"
    xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">


    <fb:metadata>
        <fb:display-name lang="en">Custom Controls</fb:display-name>
    </fb:metadata>


    <xbl:binding id="im-dynamic-list" element="im|dynamic-list" xxbl:mode="lhha binding value">
        <fb:metadata>
            <fb:display-name lang="en">Dynamic List</fb:display-name>
            <fb:icon lang="en">
                <fb:small-icon>/forms/orbeon/builder/images/listbox.png</fb:small-icon>
                <fb:large-icon>/forms/orbeon/builder/images/listbox.png</fb:large-icon>
            </fb:icon>
            <fb:template>
                <im:dynamic-list id="" ref="" xmlns="">
                    <xf:label ref="" />
                    <xf:hint ref="" />
                    <xf:help ref="" />
                    <xf:alert ref="$fr-resources/detail/labels/alert" />
                </im:dynamic-list>
            </fb:template>
        </fb:metadata>
        <xbl:template>
            <xf:group id="im-component-group">
                <xf:repeat ref="xxf:binding('im-dynamic-list')/item">
                    <xhtml:div class="xbl-im-dynamic-list-rw-input-div">
                        <xf:input ref="." />
                    </xhtml:div>
                </xf:repeat>
                <xf:trigger>
                    <xf:label>Add</xf:label>
                    <xf:action ev:event="DOMActivate">
                        <xf:insert context="xxf:binding('im-dynamic-list')" nodeset="item"
                            origin="xxf:element('item')" />
                    </xf:action>
                </xf:trigger>
            </xf:group>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

bwallis42
The problem of the control disappearing as soon as the model contained some data was this line

bwallis42 wrote
    <xbl:binding id="im-dynamic-list" element="im|dynamic-list" xxbl:mode="lhha binding value">
It shouldn't have  "value" in the xxbl:mode attribute. If I remove "value" then the control is working as expected. From reading the xbl documentation again this is not obvious to me. I now assume that "value" means a simple value, i.e. string, number, etc., not an xml structure which is what this component maintains in its model.

Is this correct?

Will I get xforms-value-changed events when I add elements to the model for this component? The documentation suggests not (http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide#TOC-Adding-support-for-a-value)

thanks,
brian...
Reply | Threaded
Open this post in threaded view
|

Re: xbl component conversion from 3.9 to 4.8

Alessandro  Vernet
Administrator
Hi Brian,

As you said, you would use xxbl:mode="value" if your component "holds a value". With xxbl:mode="value", the XForms engine keeps track of the value, and dispatches xforms-value-changed when necessary. If you component is more like a xf:group, a xf:trigger, or a xf:repeat, then it wouldn't hold a value.

Based on the snippet you gave, I am not sure what the type of your component is: it seems you're expecting the bound element to contain <item> elements, and that case the bound element indeed wouldn't directly contain a value.

I hope that this helps, and if you have a specific case that doesn't work as expected, I suggest you submit a minimal example (where you put the XBL code inside XForms) that we can run directly in the XForms sandbox to see the issue.

Alex

On Tue, May 12, 2015 at 4:46 PM, bwallis42 <[hidden email]> wrote:
The problem of the control disappearing as soon as the model contained some
data was this line


bwallis42 wrote
>
> <xbl:binding id="im-dynamic-list" element="im|dynamic-list"
> xxbl:mode="lhha binding value">

It shouldn't have  "value" in the xxbl:mode attribute. If I remove "value"
then the control is working as expected. From reading the xbl documentation
again this is not obvious to me. I now assume that "value" means a simple
value, i.e. string, number, etc., not an xml structure which is what this
component maintains in its model.

Is this correct?

Will I get xforms-value-changed events when I add elements to the model for
this component? The documentation suggests not
(http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components-guide#TOC-Adding-support-for-a-value)

thanks,
brian...


--
View this message in context: http://discuss.orbeon.com/xbl-component-conversion-from-3-9-to-4-8-tp4659866p4659918.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet