User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 391,628 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,804 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser:
Views: 2485 | Replies: 0
Reply
Join Date: Mar 2007
Posts: 1
Reputation: berntwm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
berntwm berntwm is offline Offline
Newbie Poster

Help XForms Select1 itemset model instance

  #1  
Apr 12th, 2007
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>
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb XML, XSLT and XPATH Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the XML, XSLT and XPATH Forum

All times are GMT -4. The time now is 12:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC