Any possible way to submit a nodeset?

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

Any possible way to submit a nodeset?

Larry T. Chen
Hi All,

Suppose my xforms instance has the hierarchical structure /A/B/C  where
A has multiple children B which in turn has multiple children C.
I want to post just the nodeset //C, but since the xforms-submission can
only submit one element at a time, I'd have to find some way of grouping
//C under
a single dummy element then submitting it.  Can anybody think of a way
to do this?

I thought of creating another instance and then trying to copy //c to
that instance, then submitting the instance, but I can't think of a way
to copy the multiple nodes in //C
to the instance, because xforms:insert only copies on element at a
time.  A bind statment does not work either since I do not know in
advance how many elements are in //C.

I've simplified the example for the sake of focusing on the issue.  The
actual form is a lot more complicated, that's why I want to avoid
submitting /A if at all possible.
For now I've resigned myself to submitting /A, but I'm hoping the bright
minds on this discussion group can come up with something!

Larry T. Chen
Intelenet Communications, Inc.





--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Any possible way to submit a nodeset?

Hank Ratzesberger
Hi Larry,

I presume the form is submitted to a service/xpl file
that you wrote.  That service should be able to use
xslt even simply xpath to select //C from the
instance parameter.

As the instance is already on the server, you are not
minimizing client/server traffic by creating another
instance.

Otherwise, it appears that you would need nested
xforms:repeat and xforms:insert elements to gather
the //C elements.

--Hank

Hank Ratzesberger
Institute for Crustal Studies
University of California, Santa Barbara


----- Original Message -----
From: "Larry T. Chen" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, March 15, 2007 12:10 PM
Subject: [ops-users] Any possible way to submit a nodeset?


> Hi All,
>
> Suppose my xforms instance has the hierarchical structure /A/B/C  where
> A has multiple children B which in turn has multiple children C.
> I want to post just the nodeset //C, but since the xforms-submission can
> only submit one element at a time, I'd have to find some way of grouping
> //C under
> a single dummy element then submitting it.  Can anybody think of a way
> to do this?
>
> I thought of creating another instance and then trying to copy //c to
> that instance, then submitting the instance, but I can't think of a way
> to copy the multiple nodes in //C
> to the instance, because xforms:insert only copies on element at a
> time.  A bind statment does not work either since I do not know in
> advance how many elements are in //C.
>
> I've simplified the example for the sake of focusing on the issue.  The
> actual form is a lot more complicated, that's why I want to avoid
> submitting /A if at all possible.
> For now I've resigned myself to submitting /A, but I'm hoping the bright
> minds on this discussion group can come up with something!
>
> Larry T. Chen
> Intelenet Communications, Inc.
>
>
>
>

--------------------------------------------------------------------------------


>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Any possible way to submit a nodeset?

Joseph Lawrence
In reply to this post by Larry T. Chen
Hi Larry,
     I presume that you can submit the selected item merely by using xpath expression on the @ref of the submission. I am attaching a sample test case where in I have used repeat control for the selection purpose. Please try it in the sandbox.
 
Thanks
Joseph Lawrence
Stabilix Solutions

"Larry T. Chen" <[hidden email]> wrote:
Hi All,

Suppose my xforms instance has the hierarchical structure /A/B/C where
A has multiple children B which in turn has multiple children C.
I want to post just the nodeset //C, but since the xforms-submission can
only submit one element at a time, I'd have to find some way of grouping
//C under
a single dummy element then submitting it. Can anybody think of a way
to do this?

I thought of creating another instance and then trying to copy //c to
that instance, then submitting the instance, but I can't think of a way
to copy the multiple nodes in //C
to the instance, because xforms:insert only copies on element at a
time. A bind statment does not work either since I do not know in
advance how many elements are in //C.

I've simplified the example for the sake of focusing on the issue. The
actual form is a lot more complicated, that's why I want to avoid
submitting /A if at all possible.
For now I've resigned myself to submitting /A, but I'm hoping the bright
minds on this discussion group can come up with something!

Larry T. Chen
Intelenet Communications, Inc.




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.

--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Submission.xhtml (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Any possible way to submit a nodeset? (copying multiple elements with xforms:insert)

Larry T. Chen
In reply to this post by Hank Ratzesberger
 
----- Original Message -----
From: "Hank Ratzesberger" <[hidden email]>
Sent: Thursday, March 15, 2007 2:15 PM
Subject: Re: [ops-users] Any possible way to submit a nodeset?

> Hi Larry,
>
> I presume the form is submitted to a service/xpl file
> that you wrote.  That service should be able to use
> xslt even simply xpath to select //C from the
> instance parameter.
>
 
This is what my first solution was.  Submitting /A and then selecting //C on the server.  But again there's a lot of extraneous stuff in /A that I don't really need.  I really just the node list //C.

> As the instance is already on the server, you are not
> minimizing client/server traffic by creating another
> instance.
I don't quite understand this point ... maybe I don't understand how Orbeon Forms is implemented ... or maybe I need to clarify what I'm trying to do. 
I'm doing a background post (with replace="instance" on the submission) in response to xforms-value-changed events to dynamically update certain fields
on the form based on a server-side calculation.  I'm also using client-side state handling in properties.xml.
 
<property as="xs:string" name="oxf.xforms.state-handling" value="client"/>
 
So I'd imagine minimizing what's getting posted in the background with every xforms-value-changed event would reduce
client/server traffic?

> Otherwise, it appears that you would need nested
> xforms:repeat and xforms:insert elements to gather
> the //C elements.
>
> --Hank
>
> Hank Ratzesberger
> Institute for Crustal Studies
> University of California, Santa Barbara
>
 
I tried using xforms:repeat inside an xforms:action element to try to copy multiple elements with xforms:insert.  It does not work.  Googled around a bit and found
that this question has been asked before in this user group.  See  http://mail-archive.objectweb.org/ops-users/2006-05/msg00301.html
So what I really needed was the @while attribute on xforms:insert to copy multiple elements.   Then I discovered that @while on xforms actions has been implemented for 3.5!
 
So I was able to copy //C to a temp instance for the purpose of background submission in response to xforms-value-changed by doing
 
<xforms:action ev:event="xforms-value-changed">
    <xforms:delete nodeset="instance('temp')/C" while="count(instance('temp')//C) &gt; 0"/>
    <xforms:insert nodeset="instance('temp')/" origin="//C" while="count(instance('temp')//C) &lt; count(//C)"/>
    <xforms:send submission="my-background-submission"/>
</xforms:action>
 
along with
 
<xforms:submission id="my-background-submission" ref="instance('temp')" method="post" action="..." replace="instance" instance="background-submission-response"/>
 
Someone enlighten me if there's a better way to do this?
Or .. as Hank suggested, that this approach is not really minimizing client/server traffic by background posting only what I need even though I'm using client-side state handling?
 
Larry


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Any possible way to submit a nodeset? (copying multiple elements with xforms:insert)

Hank Ratzesberger
Larry,
 
After I sent my last message, I realized that I presumed server
side handling...  You probably have done it -- minimized C/S
traffic, because with Client side state handling, the whole
instance is sent, whereas with Server side handling, the
instance is on the server and updated with xforms events
(from users typing, etc.)
 
--Hank
 
 
----- Original Message -----
Sent: Friday, March 16, 2007 12:23 AM
Subject: Re: [ops-users] Any possible way to submit a nodeset? (copying multiple elements with xforms:insert)

 
----- Original Message -----
From: "Hank Ratzesberger" <[hidden email]>
Sent: Thursday, March 15, 2007 2:15 PM
Subject: Re: [ops-users] Any possible way to submit a nodeset?

> Hi Larry,
>
> I presume the form is submitted to a service/xpl file
> that you wrote.  That service should be able to use
> xslt even simply xpath to select //C from the
> instance parameter.
>
 
This is what my first solution was.  Submitting /A and then selecting //C on the server.  But again there's a lot of extraneous stuff in /A that I don't really need.  I really just the node list //C.

> As the instance is already on the server, you are not
> minimizing client/server traffic by creating another
> instance.
I don't quite understand this point ... maybe I don't understand how Orbeon Forms is implemented ... or maybe I need to clarify what I'm trying to do. 
I'm doing a background post (with replace="instance" on the submission) in response to xforms-value-changed events to dynamically update certain fields
on the form based on a server-side calculation.  I'm also using client-side state handling in properties.xml.
 
<property as="xs:string" name="oxf.xforms.state-handling" value="client"/>
 
So I'd imagine minimizing what's getting posted in the background with every xforms-value-changed event would reduce
client/server traffic?

> Otherwise, it appears that you would need nested
> xforms:repeat and xforms:insert elements to gather
> the //C elements.
>
> --Hank
>
> Hank Ratzesberger
> Institute for Crustal Studies
> University of California, Santa Barbara
>
 
I tried using xforms:repeat inside an xforms:action element to try to copy multiple elements with xforms:insert.  It does not work.  Googled around a bit and found
that this question has been asked before in this user group.  See  http://mail-archive.objectweb.org/ops-users/2006-05/msg00301.html
So what I really needed was the @while attribute on xforms:insert to copy multiple elements.   Then I discovered that @while on xforms actions has been implemented for 3.5!
 
So I was able to copy //C to a temp instance for the purpose of background submission in response to xforms-value-changed by doing
 
<xforms:action ev:event="xforms-value-changed">
    <xforms:delete nodeset="instance('temp')/C" while="count(instance('temp')//C) &gt; 0"/>
    <xforms:insert nodeset="instance('temp')/" origin="//C" while="count(instance('temp')//C) &lt; count(//C)"/>
    <xforms:send submission="my-background-submission"/>
</xforms:action>
 
along with
 
<xforms:submission id="my-background-submission" ref="instance('temp')" method="post" action="..." replace="instance" instance="background-submission-response"/>
 
Someone enlighten me if there's a better way to do this?
Or .. as Hank suggested, that this approach is not really minimizing client/server traffic by background posting only what I need even though I'm using client-side state handling?
 
Larry



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Any possible way to submit a nodeset?

Alessandro Vernet
Administrator
In reply to this post by Larry T. Chen
Hi Larry,

On 3/15/07, Larry T. Chen <[hidden email]> wrote:
> I thought of creating another instance and then trying to copy //c to
> that instance, then submitting the instance, but I can't think of a way
> to copy the multiple nodes in //C
> to the instance, because xforms:insert only copies on element at a
> time.  A bind statment does not work either since I do not know in
> advance how many elements are in //C.

Actually you can use <xforms:insert> to insert multiple nodes:

<xforms:insert context="/container" origin="instance('source')//C"/>

If I remember this correctly, this has been changed recently in XForms 1.1.

Alex
--
Orbeon Forms - Web 2.0 Forms for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws