Re: XForms - Submission on multiple instances?

Hi Mark,

I think what Lee is saying is that he is doing a submission that will 
replace the first instance.  And that the act of this replacement of the 
first instance will affect instance nodes in a second instance document 
(I assume through recalculate or xforms-value-changed handlers?).  So he 
wants to be sure that all of that is done before he goes ahead and 
submits the second instance document.  So not as simple as just waiting 
for xforms-submit-done, is it?  It might actually work in some 
processors due to the nature of single threading, but it isn't 
guaranteed to work, is it?

--Aaron

Mark Birbeck wrote:
> 
> Hi Lee,
> 
> I'm not with you...are you saying this doesn't work? It should do, and
> it's a technique that is used quite a lot.
> 
> The other way to do it is to dispatch an event on the successful first
> submission, and then listen for that. We often do things like this:
> 
>  <xf:model id="mdl">
>    <xf:submission id="submission1"
>     method="post" action="somepage.cgi"
>     ref="instance('instance1')" replace="instance" instance="instance1"
>    >
>      <xf:dispatch ev:event="xforms-submit-done"
>       target="mdl" name="login-complete"
>     />
>    </xf:submission>
> 
>    <xf:action ev:event="login-complete">
>      ...
>    </xf:action>
>  </xf:model>
> 
> In other words, we tend to map the "submission complete" event to
> something at a higher level, like "login complete", "customer
> created", "blog deleted", etc.
> 
> Regards,
> 
> Mark
> 
> On 31/10/06, Lee Standen <nom@standen.id.au> wrote:
>>
>> Hi Guys,
>>
>> I'm hoping someone has come across this, and knows the "correct" way to
>> implement it.
>>
>> I'm trying to setup an submission so that a successful submission
>> triggers another submission to occur, and I've not had too much luck so
>> far.  These are a couple of the things I've tried:
>>
>> This is a simplified version, but basically instance2 contains a list of
>> values which are (potentially) changed when instance1 is submitted, so
>> it needs to be refreshed before allowing the user to submit more forms.
>>
>> Ideas?
>>
>> Snippet:
>> <xf:model id="mdl">
>> <xf:instance id="instance1" src="somepage.cgi" />
>> <xf:instance id="instance2" src="someotherpage.cgi" />
>>
>> <xf:submission id="submission1" method="post" action="somepage.cgi"
>> ref="instance('instance1')" replace="instance" instance="instance1">
>>    <xf:send ev:event="xforms-submit-done" submission="submission2" />
>> </xf:submission>
>>
>> <xf:submission id="submission2" method="post" action="someotherpage.cgi"
>> ref="instance('instance2')" replace="instance" instance="instance2" />
>> </xf:model>
>>
>> ....
>>
>> <xf:submit submission="submission1">
>>    <xf:label>Save & Reload List</xf:label>
>> </xf:submit>
>>
>>
>>
>>
>>
> 
> 

Received on Tuesday, 31 October 2006 19:54:44 UTC