berntwm 0 Newbie Poster

Dear all
See XHTML document below,
Question and comments are with the text

Thx
Bernt

<?xml version="1.0" encoding="UTF-16"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xforms="http://www.w3.org/2002/xforms">

<head>   <link href="EWIN_XFORMS.css" rel="stylesheet"/>

<title>XForms Itemset Example</title>

<xforms:model id="main">
    <xforms:instance>
        <xforms:DOCUMENT documentName="MyReportXX">

<xforms:STATUS MYCHOICE="1" REMARK="">

</xforms:STATUS>

            <xforms:STATUS MYCHOICE="11" REMARK="">
            </xforms:STATUS>
</xforms:DOCUMENT>
    </xforms:instance>
    <xforms:bind nodeset="/xforms:DOCUMENT/xforms:STATUS[1]/@MYCHOICE" id="MC1"/>
    <xforms:bind nodeset="/xforms:DOCUMENT/xforms:STATUS[2]/@MYCHOICE" id="MC2"/>
    <xforms:bind nodeset="/xforms:DOCUMENT/xforms:STATUS[1]/@REMARK" id="REM1"/>
    <xforms:bind nodeset="/xforms:DOCUMENT/xforms:STATUS[2]/@REMARK" id="REM2"/>

    <xforms:submission id="Save" action="file//:LocalFile.xml" method="put"></xforms:submission>

</xforms:model>
<xforms:model id="allowedAnswers" xslns="">
  <xforms:instance id="A">
    <xforms:opt1>
    <xforms:answ>
        <xforms:ALLOWED_ANSWER_TEXT>Medium</xforms:ALLOWED_ANSWER_TEXT>
        <xforms:ANSWER_CODE>1</xforms:ANSWER_CODE>
    </xforms:answ>
    <xforms:answ>
        <xforms:ALLOWED_ANSWER_TEXT>Some Good some bad</xforms:ALLOWED_ANSWER_TEXT>
        <xforms:ANSWER_CODE>2</xforms:ANSWER_CODE>
    </xforms:answ>
    <xforms:answ>
        <xforms:ALLOWED_ANSWER_TEXT>Happy</xforms:ALLOWED_ANSWER_TEXT>
        <xforms:ANSWER_CODE>3</xforms:ANSWER_CODE>
    </xforms:answ>
    </xforms:opt1>
 </xforms:instance>


  <xforms:instance id="B">
    <xforms:opt1>
    <xforms:answ>
        <xforms:ALLOWED_ANSWER_TEXT>BB I don&apos;t think</xforms:ALLOWED_ANSWER_TEXT>
        <xforms:ANSWER_CODE>11</xforms:ANSWER_CODE>
    </xforms:answ>
    <xforms:answ>
        <xforms:ALLOWED_ANSWER_TEXT>I was not there</xforms:ALLOWED_ANSWER_TEXT>
        <xforms:ANSWER_CODE>12</xforms:ANSWER_CODE>
    </xforms:answ>
   </xforms:opt1>
 </xforms:instance>
</xforms:model>
</head>
<body>
<!-- Itemset example -->

<xforms:select1 bind="MC1" appearance="minimal">
    <xforms:label>What do u think about when u see snow?</xforms:label>

<!-- Why does not this work ????????????
I just want to have different options for each question !!!!!!
I know I can make a new model for each selection (but that is not what I wanna do)

<xforms:itemset model="allowedAnswers" nodeset="instance('A')/xforms:opt1/xforms:answ">

according to hundres of tutorial and books this is how to do it

I'm using FireFox with the Xforms plug-in and I cannot use IEXPLORE with plug-in
because IEXPLORE does work well with file protocol (only http)
-->

<xforms:itemset model="allowedAnswers" nodeset="/xforms:opt1/xforms:answ">
        <xforms:label ref="xforms:ALLOWED_ANSWER_TEXT"></xforms:label>
        <xforms:value ref="xforms:ANSWER_CODE"></xforms:value>
    </xforms:itemset>
</xforms:select1>

<xforms:input bind="REM1">
    <xforms:label>Remark:</xforms:label>
</xforms:input>

<xforms:select1 bind="MC2"  appearance="minimal">
    <xforms:label>What do u think about the weather last week in October 6 years ago?</xforms:label>

<!-- Neither this work ????????????
<xforms:itemset model="allowedAnswers" instance="B" nodeset="/xforms:opt1/xforms:answ">

The line below works but it always pick the first instance
-->

<xforms:itemset model="allowedAnswers" nodeset="/xforms:opt1/xforms:answ">
        <xforms:label ref="xforms:ALLOWED_ANSWER_TEXT"/>
        <xforms:value ref="xforms:ANSWER_CODE"/>
    </xforms:itemset>
</xforms:select1>

<xforms:input bind="REM2">
    <xforms:label>Remark:</xforms:label>
</xforms:input>
<xforms:submit submission="Save"><label>Save</label></xforms:submit>
<xforms:submit submission="Submit"><label>Submit</label></xforms:submit>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.