Passing parameters to XBL

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

Passing parameters to XBL

pzeszko
Hello, I've created these simple files, xhtml :

<html xmlns="http://www.w3.org/1999/xhtml"
      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:fr="http://orbeon.org/oxf/xml/form-runner"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
    <head>
        <title>Test</title>
        <xf:model>

            <!-- Instance that contains all the books -->
            <xf:instance id="people-instance">
                <people xmlns="">
                    <person>
            <test/>
                    </person>
                </people>
            </xf:instance>
<xf:bind id="test-bind" name="test" ref="person/test"/>
        </xf:model>
       
    </head>
    <body>
<xf:input id="test-control" bind="test-bind">
   <xf:label>THIS</xf:label>
</xf:input>
<fr:my-name test="'test'">
</fr:my-name>
    </body>
</html>

And XBL :

<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:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:xbl="http://www.w3.org/ns/xbl"
         xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
    xmlns:fb="http://orbeon.org/oxf/xml/form-builder">

    <xbl:binding element="fr|my-name" id="fr-my-name" xxbl:mode="lhha binding value">
   <metadata xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:xf="http://www.w3.org/2002/xforms">
<templates>
              <view>
                   <fr:my-name id="" appearance="minimal"   xmlns="" test="" >
          </fr:my-name>
               </view>
         </templates>
                
         <xf:input ref="@test">
   <xf:label lang="en">Resource URI</xf:label>
          </xf:input>
              
        </metadata>
        <xbl:template>
            <!-- Local model and instance -->
   <xf:var name="test-avt" xbl:attr="xbl:text=test" xxbl:scope="outer"/>
            <xf:var name="test" xbl:attr="xbl:text=test" >
       <xf:action ev:event="xforms-enabled xforms-value-changed">
           <xf:setvalue ref="instance('test')" value="$test"/>
       </xf:action>
     <xxf:sequence value="xxf:evaluate-avt($test-avt)" xxbl:scope="outer"/>
         </xf:var>
        <xf:model>
  <xf:instance id="test"><value/></xf:instance>
           <xf:instance><value/></xf:instance>
  <xf:submission id="save-submission" ref="instance('test')"
                    action="/exist/rest/db/orbeon/my-name/person.xml"
                    method="put" replace="none">
                    <xf:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xf:message>
                </xf:submission>
         </xf:model>
   <xf:input class="xforms-disabled" ref="xxf:instance('people-instance')//*[name() = saxon:evaluate($test)]" >
       <xf:label>Your name</xf:label>
       <xf:send ev:event="xforms-value-changed" submission="save-submission"/> 
   </xf:input>
        
      </xbl:template>
    </xbl:binding>
</xbl:xbl>


Now I would like pass parameters from my view.xhtml to XBL so when user inserts something in **xf:input id='test-control'** it would cause that the text will be saved in database.
The problem is, instead of what user actually inserted in my database I have :

    <value>'test'</value>

instead of expected, f.e. if I insert 123

    <value>123</value>

Anyone has any idea why my code doesn't work and how to fix this ?

P.S. If you would like you can see my code here :

view.xhtml : http://hastebin.com/ferexovamo.xml
my-name.xbl : http://hastebin.com/deguyabexo.xml

--
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: Passing parameters to XBL

Erik Bruchez
Administrator
For reference this has been handled on StackOverflow:

    http://stackoverflow.com/questions/27525931/passing-parameters-to-xbl-in-orbeon/27532863#27532863

-Erik