W3C home > Mailing lists > Public > www-forms@w3.org > February 2004

populate lists using instance data from models

From: sgu <sgu88@yahoo.com>
Date: Fri, 6 Feb 2004 09:05:41 -0800 (PST)
Message-ID: <20040206170541.9436.qmail@web60307.mail.yahoo.com>
To: www-forms@w3.org

Hello, 

I am trying to populate two lists using instance data
from two models, I am using Chiba as form processor,
and 
modified a chiba sample file to see how I can achieve
that. I defined two models/instances for priority-list
and status-list in head, and used itemset tag inside
body to try to display these two lists. But only two
empty lists are displayed. Can anyone tell what I dod
wrong here.

regards,


<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
    chiba:stylesheet="html4.xsl"
   
xmlns:chiba="http://chiba.sourceforge.net/2003/08/xforms"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xlink="http://www.w3.org/1999/xlink">
    <head>
        <title>todo-list</title>
        <xforms:model id="C-1">
            <xforms:bind id="list"
xforms:nodeset="/todo-list/todo" xforms:type="string">
                <!--xforms:bind id="description-bind"
xforms:nodeset="description" xforms:type="string"
xforms:required="true()"/-->
                <xforms:bind id="priority-bind"
xforms:nodeset="priority" xforms:type="integer"/>
                <!--xforms:bind id="target-date-bind"
xforms:nodeset="target-date" xforms:type="string"/-->
                <xforms:bind id="status"
xforms:nodeset="status" xforms:type="string"/>
            </xforms:bind>
            <xforms:schema/>
            <xforms:submission id="save"
xforms:action="todo-data.xml" xforms:method="put"
xforms:replace="none"
                omit-xml-declaration="false()"
mediatype="text/xml"/>
            <xforms:instance id="C-2" xmlns="">
                <todo-list>
                    <todo>
                        <!--description/-->
                        <!--target-date/-->
                        <priority/>
                        <status/>
                    </todo>
                </todo-list>
            </xforms:instance>
        </xforms:model>
        
        <xforms:model id="P-1">
        	<xforms:instance>
        		<priority-list>
        			<priority value="1">1</priority>
        			<priority value="2">2</priority>
        			<priority value="3">3</priority>
        			<priority value="4">4</priority>
        			<priority value="5">5</priority>
        		</priority-list>
        	</xforms:instance>
        </xforms:model>
        
        <xforms:model id="S-1">
        	<xforms:instance>
        		<status-list>
        			<status value="not started">not
started</status>
        			<status value="in progress">in
progress</status>
        			<status value="finished">finished</status>
        		</status-list>
        	</xforms:instance>
        </xforms:model>
        
    </head>
    <body>
        <span class="text12">
        This example will write the list of todos to a
local file called 'todo-data.xml' every time you hit
the 'save'-button.
        'todo-data.xml' can be found in the same
directory as this form.
        </span>
        <xforms:group id="C-3" class="todo-list">
            <xforms:label>todo list</xforms:label>
            <xforms:repeat chiba:index="1" id="todo"
xforms:bind="list" xforms:appearance="compact">
                <!--
                <xforms:input id="description"
xforms:bind="description-bind">
                   
<xforms:label>Description</xforms:label>
                </xforms:input>
                -->
                <xforms:select1 id="priority"
xforms:appearance="minimal"
xforms:ref="/todo-list/todo/priority">
                    <xforms:label
id="priority-lbl">Priority</xforms:label>
                    <xforms:itemset model="P-1"
xforms:nodeset="/priority-list/priority">
                    	<xforms:label xforms:ref="." />
 						<xforms:value  xforms:ref="@value" />
                    </xforms:itemset>
                </xforms:select1>
                <!--
                <xforms:input id="target-date"
xforms:ref="/todo-list/todo[xforms:index(&apos;todo&apos;)]/target-date">
                    <xforms:label
id="date-lbl">Due</xforms:label>
                    <xforms:alert id=".34"/>
                </xforms:input>
                -->
                <xforms:select1 id="C-31"
xforms:appearance="minimal"
xforms:ref="/todo-list/todo[xforms:index(&apos;todo&apos;)]/status">
                    <xforms:label
id="status-lbl">Status</xforms:label>
                    <xforms:itemset model="S-1"
xforms:nodeset="/status-list/status">
                    	<xforms:label xforms:ref="." />
 						<xforms:value  xforms:ref="@value" />
                    </xforms:itemset>
                </xforms:select1>
            </xforms:repeat>

            <xforms:group appearance="minimal">
                <xforms:trigger id=".65">
                    <xforms:label
id=".66">Insert</xforms:label>
                    <xforms:action id="C-32">
                        <xforms:insert id=".67"
xforms:at="xforms:index(&apos;todo&apos;)"
xforms:nodeset="/todo-list/todo"
xforms:position="after"/>
                        <!--xforms:setvalue
xforms:bind="description" xforms:value="''"/-->
                        <xforms:setvalue
xforms:bind="priority" xforms:value="''"/>
                        <!--xforms:setvalue
xforms:bind="target-date" xforms:value="''"/-->
                        <xforms:setvalue
xforms:bind="status" xforms:value="''"/>
                    </xforms:action>
                </xforms:trigger>
                <xforms:trigger id=".70">
                    <xforms:label
id=".71">Delete</xforms:label>
                    <xforms:delete id=".69"
xforms:at="xforms:index(&apos;todo&apos;)"
xforms:nodeset="/todo-list/todo"/>
                </xforms:trigger>
                <xforms:submit id=".63"
xforms:submission="save">
                    <xforms:label
id=".64">Save</xforms:label>
                </xforms:submit>
            </xforms:group>
        </xforms:group>
    </body>
</html>

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
Received on Friday, 6 February 2004 12:07:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:57 GMT