You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ellis Pritchard <el...@nukinetics.com> on 2007/06/07 17:46:53 UTC

CForm Ajax: how does the continuation-id get updated?

Hi,

I'm obviously doing something wrong but I can't work out how the  
continuation-id is supposed to get updated when using CForms with  
Ajax and javascript flow (Cocoon 2.1.10).

My particular problem is with repeaters; I'm adding rows using the  
repeater actions, however, the continuation-id in the form is not  
being updated after the action has run, since only the updated  
widgets get sent back to the browser, and the continuation id isn't a  
widget; so if you add another row using the added repeater, you get  
an "Invalid submit id (no such widget):" exception, because you are  
still in the previous Form model, where the new row doesn't exist.

What I don't understand is how this is supposed to work at all; the  
BrowserUpdateTransformer, and JX macros (+JXMacrosHelper.java) don't  
seem to handle updating the continuation-id, i.e. sending it back to  
the browser regardless, so how is it supposed to happen?

Or am I missing something fundamental (or just mental)!


Cheers
Ellis.




My forms pipeline looks like:

             <map:match pattern="continue">
                 <map:call continuation="{request-param:continuation- 
id}"/>
             </map:match>

             <map:match pattern="main/search/form">
                 <map:generate type="newjx" src="flow/search/search- 
template.xml" label="form">
                     <map:parameter name="submitURI"  
value="{request:contextPath}/{request:sitemapURIPrefix}continue"/>
                     <map:parameter name="resources-uri"  
value="{request:contextPath}/{request:sitemapURIPrefix}resources"/>
                 </map:generate>
                 <map:transform type="browser-update" label="form-bu"/>
                 <map:transform type="i18n" label="form-i18n">
                     <map:parameter name="locale" value="en-US"/>
                 </map:transform>
                 <map:transform src="xsl/forms/forms-styling.xsl"  
label="form-styling">
                     <map:parameter name="resources-uri"  
value="{request:contextPath}/{request:sitemapURIPrefix}resources"/>
                 </map:transform>
                 <map:serialize type="xml"/>
             </map:match>

My template has:

     <ft:form action="${cocoon.parameters['submitURI']}"  
method="POST" ajax="true">

         <ft:continuation-id/>
		...

and I'm using the standard forms styling.

(I've also tried encoding the continuation in the ft:form action URL).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForm Ajax: how does the continuation-id get updated?

Posted by Ellis Pritchard <el...@nukinetics.com>.
Solved, this is a documentation problem :)

http://cocoon.zones.apache.org/daisy/cdocs/g1/g2/g7/forms/g3/750.html? 
showComments=true#daisycomment66

Describes what is necessary to convert repeaters to AJAX, i.e.  
replacement of ft:repeater-widget with ft:repeater etc.

However, this should also mention that the <ft:repeater-rows>  
template definition is no longer required, and indeed, interferes  
with the correct operation of the repeater, since it doesn't get  
updated as part of the AJAX update, and therefore recently added rows  
are removed on the new request, leading to "Invalid submit id (no  
such widget)" errors. (Removal happens as a result of the code at  
Repeater.java:346-371).

That one has cost me a day and made me look like an idiot.

I can forgive the last part ;)

Ellis.



On 8 Jun 2007, at 10:23, Ellis Pritchard wrote:

> Ok, my misunderstanding; the continuation id doesn't get updated  
> when non in AJAX mode either, and that works fine.
>
> So now all I've got to explain is why my repeater doesn't work  
> properly in AJAX mode: I'm still getting "Invalid submit id (no  
> such widget)" when triggering actions on newly added rows.
>
> Ellis.
>
>
> On 7 Jun 2007, at 16:46, Ellis Pritchard wrote:
>
>> Hi,
>>
>> I'm obviously doing something wrong but I can't work out how the  
>> continuation-id is supposed to get updated when using CForms with  
>> Ajax and javascript flow (Cocoon 2.1.10).
>>
>> My particular problem is with repeaters; I'm adding rows using the  
>> repeater actions, however, the continuation-id in the form is not  
>> being updated after the action has run, since only the updated  
>> widgets get sent back to the browser, and the continuation id  
>> isn't a widget; so if you add another row using the added  
>> repeater, you get an "Invalid submit id (no such widget):"  
>> exception, because you are still in the previous Form model, where  
>> the new row doesn't exist.
>>
>> What I don't understand is how this is supposed to work at all;  
>> the BrowserUpdateTransformer, and JX macros (+JXMacrosHelper.java)  
>> don't seem to handle updating the continuation-id, i.e. sending it  
>> back to the browser regardless, so how is it supposed to happen?
>>
>> Or am I missing something fundamental (or just mental)!
>>
>>
>> Cheers
>> Ellis.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForm Ajax: how does the continuation-id get updated?

Posted by Ellis Pritchard <el...@nukinetics.com>.
Ok, my misunderstanding; the continuation id doesn't get updated when  
non in AJAX mode either, and that works fine.

So now all I've got to explain is why my repeater doesn't work  
properly in AJAX mode: I'm still getting "Invalid submit id (no such  
widget)" when triggering actions on newly added rows.

Ellis.


On 7 Jun 2007, at 16:46, Ellis Pritchard wrote:

> Hi,
>
> I'm obviously doing something wrong but I can't work out how the  
> continuation-id is supposed to get updated when using CForms with  
> Ajax and javascript flow (Cocoon 2.1.10).
>
> My particular problem is with repeaters; I'm adding rows using the  
> repeater actions, however, the continuation-id in the form is not  
> being updated after the action has run, since only the updated  
> widgets get sent back to the browser, and the continuation id isn't  
> a widget; so if you add another row using the added repeater, you  
> get an "Invalid submit id (no such widget):" exception, because you  
> are still in the previous Form model, where the new row doesn't exist.
>
> What I don't understand is how this is supposed to work at all; the  
> BrowserUpdateTransformer, and JX macros (+JXMacrosHelper.java)  
> don't seem to handle updating the continuation-id, i.e. sending it  
> back to the browser regardless, so how is it supposed to happen?
>
> Or am I missing something fundamental (or just mental)!
>
>
> Cheers
> Ellis.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org