Binding multiple modes in single component

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

Binding multiple modes in single component

Ajit
This post was updated on .
Hello Alex

I have created custom component.

i have created multiple controls in single component

i want save that control value in database

but when i trying to bind that component to root binding it get same value
for both control

is there any way to multiple binding for multiple control in same component

help me for same  with any document or  example.

following is my xbl file


<xbl:xbl 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: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:ucsf="http://www.ucsf.com/xbl"
        xmlns:saxon="http://saxon.sf.net/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
        xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
        xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns="http://www.w3.org/1999/xhtml">
        <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
                <display-name lang="en">UCSF Controls</display-name>
        </metadata>
        <xbl:binding id="ucsf-medication-add-remove"
element="ucsf|medication-add-remove"
                xxbl:mode="lhha binding value">
                <fb:metadata>
                        <fb:display-name lang="en">Medication Add Remove
                        </fb:display-name>
                        <fb:icon lang="en">
                                <fb:small-icon>/forms/orbeon/builder/images/dropdown.png
                                </fb:small-icon>
                                <fb:large-icon>/forms/orbeon/builder/images/dropdown.png
                                </fb:large-icon>
                        </fb:icon>
                        <xbl:resources>
                                <xbl:style src="/xbl/ucsf/medication-history/medication-history.css" />
                        </xbl:resources>
                       
                </fb:metadata>
                <xbl:implementation>
                        <xf:model id="medication">
                                <xf:instance id="reason" xmlns="">
                                        <root>
                                                <item name="Drug discontinued - patient fearisk1"/>
                                                <item name="Drug discontinued - patient fearisk2"/>
                                                <item name="Drug discontinued - patient fearisk3"/>
                                                <item name="Drug discontinued - patient fearisk4"/>
                                        </root>
                                </xf:instance>
                        </xf:model>
                </xbl:implementation>
                <xbl:template >       
                        <xf:select1 class="select2select" id="stopReason"
                                ref="xxf:binding('ucsf-medication-add-remove')">
                                <xf:itemset nodeset="instance('reason')/item">
                                        <xf:label ref="@name" />
                                        <xf:value ref="@name" />
                                </xf:itemset>
                        </xf:select1>
                    <xf:input ref="xxf:binding('ucsf-medication-add-remove')"/>
                </xbl:template>
        </xbl:binding>
</xbl:xbl>


--
Sent from: http://discuss.orbeon.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 orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Binding multiple modes in single component

Alessandro  Vernet
Administrator
Hi Ajit,

Are you saying that you'd like that control to capture 2 distinct values:
one with the dropdown, and the other with the input field, and you would
like both values to be stored in the form data?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Binding multiple modes in single component

Ajit
Hi Alex,

Yes you got that, I want to control to capture 2 distinct values:
one with the dropdown, and the other with the input field and would like to
store both the values in the form data.

Regards,
Ajit

--
Sent from: http://discuss.orbeon.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: Binding multiple modes in single component

Alessandro  Vernet
Administrator
Hi Ajit,

Here is a  medication-add-remove.xbl
<http://discuss.orbeon.com/file/t119778/medication-add-remove.xbl>   that
shows how this can be done.

You'll see how both the dropdown and the input are now bound to a local
instance, but thanks to the `xxbl:mirror="true"` that instance is mirrored
from and to the node bound to the component. I've chosen, somewhat
arbitrarily, to have the medication stored inside the element, and the
reason as an attribute. But you could use 2 children elements, or 2
attributes, or whatever makes the most sense in your case.

You'll let me know if this helps,

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Binding multiple modes in single component

Ajit
Thanks Alex

Its working fine

--
Sent from: http://discuss.orbeon.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: Binding multiple modes in single component

Alessandro  Vernet
Administrator
Excellent Ajit, I'm glad saving the 2 pieces of information in the instance
this way worked for you, and thanks for the update.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet