W3C home > Mailing lists > Public > www-forms@w3.org > November 2006

Re: Repeat and Submission

From: Christian Lebe <christianlebe@gmail.com>
Date: Thu, 9 Nov 2006 09:24:33 +0800
Message-ID: <61929f260611081724u2346f114ked4f49ca33d6e868@mail.gmail.com>
To: www-forms@w3.org
Hi Swithun,

Thank you for your reply.

I have changed my instance according to what you have suggested:

<xf:instance id="values"><forms xmlns=""/></xf:instance>

<xf:submission id="getValue" instance="values" ref="instance('form')"
action="admin.cgi?action=getPermissionAccess" method="post"
replace="instance" />

And in my body...
<xf:repeat>
<td><label>Allowed Access By</label></td>
        <td>
        <xf:select1 ref="type">
            <xf:label/>
                <xf:item>
                    <xf:label>Department</xf:label>
                    <xf:value>1</xf:value>
                </xf:item>
                <xf:item>
                    <xf:label>Team</xf:label>
                    <xf:value>2</xf:value>
                </xf:item>
                <xf:item>
                    <xf:label>Position</xf:label>
                    <xf:value>3</xf:value>
                </xf:item>
             <xf:send ev:event="xforms-value-changed" submission="getValue">
             </xf:send>
            </xf:select1>
        </td>
    </tr>
    <tr>
       <td><label>Value</label></td>
       <td>
            <xf:select1 ref="value">
            <xf:label />
            <xf:itemset nodeset="instance('values')/value">
            <xf:label ref="@name" />
            <xf:value ref="@id" />
            </xf:itemset>
            </xf:select1>
       </td>
    </tr>
</xf:repeat>
It's working perfectly for single attribute. But when I put the the select1
inside repeat statement, it acts quite funny. The second pull down list no
longer works.
I think i should pass the index somewhere but still not quite sure.

I'll go digging some more info about the Mark Birbeck's post.

Thanks heaps for your help!

Christian



On 11/9/06, Swithun Crowe <swithun@swithun.servebeer.com> wrote:
>
> Hello
>
> CL I'm a noob at xforms so any help on this will be very much appreciated.
> CL Basically, I have two dropdown list that are dependants to the option
> CL selected on the first one.
>
> You could make a few changes, which might make your form work.
>
> CL <xf:instance id="values" src="admin.cgi?action=getPermissionAccess"/>
>
> This could be something like:
>
> <xf:instance id="values"><root xmlns=""/></xf:instance>
>
> to start with. It only needs to be populated once an item from the first
> list is selected.
>
> CL        <xf:submission id="getValue" instance="values"
> CL ref="instance('form')/access[index('accessRepeat')]"
> CL action="admin.cgi?action=getPermissionAccess"
> CL method="post" replace="instance" />
>
> You want to @ref instance('form')/access/type here - this is what holds
> the selected value in the first list, so is presumably what you want to
> send back and use to populate the second list.
>
> CL             <xf:send ev:event="xforms-value-changed"
> submission="getValue"
> CL at="index('accessRepeat')">
>
> You don't need at @at attribute for xf:send.
>
> A while ago Mark Birbeck posted a link to his blog showing how to emulate
> Google Suggest with 5 lines of XForms, rather than 100 lines of
> JavaScript. It is pretty much what you want to do (swapping xf:input for
> xf:select1). That page will explain everything.
>
> Swithun.
>



-- 
Christian Lebe
<christian@moodle.com>
Moodle.com Support
Life is a perpetual learning process;
Received on Thursday, 9 November 2006 01:24:46 GMT

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