Javascript error with relevant bind

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

Javascript error with relevant bind

AlecL
I'm running into a problem with the <bind relevant=.../> xforms function.  I have set up my form such that when you select 'yes' in a selection box, it should display a bunch of inputs for entering further data.  Instead, it seems a javascript error is occuring (The "exception in client-side code" dialog).  Check it out for yourself:

<?xml version="1.0" encoding="utf-8"?>
<html
    xmlns="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:xxforms="http://orbeon.org/oxf/xml/xforms">
  <head>
    <xforms:model id="mainModel">
      <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified">
               
        <xs:simpleType name="answer">
          <xs:restriction base="xs:string">
            <xs:enumeration value="yes"/>
            <xs:enumeration value="no"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:schema>

     
      <xforms:instance id="answer-instance">
        <answer xmlns="">
          <response/>
          <questionText>Were any employees injured on the job yesterday?</questionText>
          <answers>
            <subAnswerSet>
              <subAnswer>
                <key>Employee number:</key>
                <value/>
              </subAnswer>
              <subAnswer>
                <key>Date of incident:</key>
                <value/>
              </subAnswer>
              <subAnswer>
                <key>Contact person:</key>
                <value/>
              </subAnswer>
              <subAnswer>
                <key>Description:</key>
                <value/>
              </subAnswer>
            </subAnswerSet>
          </answers>
        </answer>
      </xforms:instance>
     
      <xforms:bind nodeset="/answer/answers" relevant="/answer/response = 'true'"/>
     
     
      <xforms:submission id="save-submission" ref="instance('answer-instance')"
          action="http://localhost:8080/lesschwab-pm-webapp/eod/submitData" method="post" replace="instance">
        <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
      </xforms:submission>
     
    </xforms:model>
    <link rel="stylesheet" type="text/css" href='/css/eod-styles.css'/>
  </head>
  <body>
    <div>
      <xforms:select1 ref="/answer/response">
        <xforms:label class="books-label" ref="../questionText"/>
        <xforms:item>
          <xforms:label/>
          <xforms:value/>
        </xforms:item>
        <xforms:item>
          <xforms:label>yes</xforms:label>
          <xforms:value>true</xforms:value>
        </xforms:item>
        <xforms:item>
          <xforms:label>no</xforms:label>
          <xforms:value>false</xforms:value>
        </xforms:item>
      </xforms:select1>
    </div>
    <xforms:group ref="/answer/answers" id="answerGroup">
      <xforms:repeat nodeset="subAnswerSet" id="subAnswerSet-repeat">
        <div>
          Incident:
         
            <xforms:trigger appearance="minimal">
              <xforms:delete ev:event="DOMActivate" context="instance('answer-instance')"
                nodeset="subAnswerSet" at="index('subAnswerSet-repeat')"/>
              <xforms:label>
               
                Remove
              </xforms:label>
            </xforms:trigger>
         

        </div>
        <xforms:repeat nodeset=".[index('subAnswerSet-repeat')]/subAnswer" id="subAnswer-repeat">
          <div class="sub-question-indent">
            <xforms:input ref="value">
              <xforms:label class="books-label" ref="../key"/>
            </xforms:input>
          </div>
        </xforms:repeat>
        <xforms:trigger appearance="minimal">
          <xforms:label>
           
            Add
          </xforms:label>
          <xforms:insert ev:event="DOMActivate" context="instance('answer-instance')"
            nodeset="." at="index('subAnswerSet-repeat')" position="after"/>
        </xforms:trigger>
      </xforms:repeat>
    </xforms:group>
    <div>
      <xforms:submit submission="save-submission" appearance="minimal">
        <xforms:label>
          Save
          Next
        </xforms:label>
      </xforms:submit>
    </div>
  </body>
</html>
Reply | Threaded
Open this post in threaded view
|

Re: Javascript error with relevant bind

Erik Bruchez
Administrator
Works for me with recent build on FF 3.0.6 and Safari 3.2.1.

-Erik

On Feb 20, 2009, at 3:09 PM, AlecL wrote:

>
> I'm running into a problem with the <bind relevant=.../> xforms  
> function.  I
> have set up my form such that when you select 'yes' in a selection  
> box, it
> should display a bunch of inputs for entering further data.  
> Instead, it
> seems a javascript error is occuring (The "exception in client-side  
> code"
> dialog).  Check it out for yourself:
>
> <?xml version="1.0" encoding="utf-8"?>
> <html
>    xmlns="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:xxforms="http://orbeon.org/oxf/xml/xforms">
>  <head>
>    <xforms:model id="mainModel">
>      <xs:schema elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>                <!-- Type for language -->
>        <xs:simpleType name="answer">
>          <xs:restriction base="xs:string">
>            <xs:enumeration value="yes"/>
>            <xs:enumeration value="no"/>
>          </xs:restriction>
>        </xs:simpleType>
>      </xs:schema>
>
>      <!-- Instance that contains the answer -->
>      <xforms:instance id="answer-instance">
>        <answer xmlns="">
>          <response/>
>          <questionText>Were any employees injured on the job
> yesterday?</questionText>
>          <answers>
>            <subAnswerSet>
>              <subAnswer>
>                <key>Employee number:</key>
>                <value/>
>              </subAnswer>
>              <subAnswer>
>                <key>Date of incident:</key>
>                <value/>
>              </subAnswer>
>              <subAnswer>
>                <key>Contact person:</key>
>                <value/>
>              </subAnswer>
>              <subAnswer>
>                <key>Description:</key>
>                <value/>
>              </subAnswer>
>            </subAnswerSet>
>          </answers>
>        </answer>
>      </xforms:instance>
>
>      <xforms:bind nodeset="/answer/answers" relevant="/answer/
> response =
> 'true'"/>
>
>      <!-- Submission to save the document containing all the books -->
>      <xforms:submission id="save-submission"
> ref="instance('answer-instance')"
>          action="http://localhost:8080/lesschwab-pm-webapp/eod/submitData 
> "
> method="post" replace="instance">
>        <xforms:message ev:event="xforms-submit-error" level="modal">An
> error occurred while saving!</xforms:message>
>      </xforms:submission>
>
>    </xforms:model>
>    <link rel="stylesheet" type="text/css" href='/css/eod-styles.css'/>
>  </head>
>  <body>
>    <div>
>      <xforms:select1 ref="/answer/response">
>        <xforms:label class="books-label" ref="../questionText"/>
>        <xforms:item>
>          <xforms:label/>
>          <xforms:value/>
>        </xforms:item>
>        <xforms:item>
>          <xforms:label>yes</xforms:label>
>          <xforms:value>true</xforms:value>
>        </xforms:item>
>        <xforms:item>
>          <xforms:label>no</xforms:label>
>          <xforms:value>false</xforms:value>
>        </xforms:item>
>      </xforms:select1>
>    </div>
>    <xforms:group ref="/answer/answers" id="answerGroup">
>      <xforms:repeat nodeset="subAnswerSet" id="subAnswerSet-repeat">
>        <div>
>          Incident:
>
>            <xforms:trigger appearance="minimal">
>              <xforms:delete ev:event="DOMActivate"
> context="instance('answer-instance')"
>                nodeset="subAnswerSet" at="index('subAnswerSet-
> repeat')"/>
>              <xforms:label>
>                 /resources/apps/xforms-bookcast/images/remove.gif
>                Remove
>              </xforms:label>
>            </xforms:trigger>
>
>        </div>
>        <xforms:repeat nodeset=".[index('subAnswerSet-repeat')]/
> subAnswer"
> id="subAnswer-repeat">
>          <div class="sub-question-indent">
>            <xforms:input ref="value">
>              <xforms:label class="books-label" ref="../key"/>
>            </xforms:input>
>          </div>
>        </xforms:repeat>
>        <xforms:trigger appearance="minimal">
>          <xforms:label>
>             /resources/apps/xforms-bookcast/images/add.gif
>            Add
>          </xforms:label>
>          <xforms:insert ev:event="DOMActivate"
> context="instance('answer-instance')"
>            nodeset="." at="index('subAnswerSet-repeat')"  
> position="after"/>
>        </xforms:trigger>
>      </xforms:repeat>
>    </xforms:group>
>    <div>
>      <xforms:submit submission="save-submission" appearance="minimal">
>        <xforms:label>
>           /resources/apps/xforms-bookcast/images/save.gif
>          Next
>        </xforms:label>
>      </xforms:submit>
>    </div>
>  </body>
> </html>
> --
> View this message in context: http://www.nabble.com/Javascript-error-with-relevant-bind-tp22130207p22130207.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws