You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robin Wyles <ro...@robinwyles.com> on 2005/12/06 12:10:02 UTC

AJAX and upload field

Hi All,

I noticed that if a form contains a file field then AJAX is completely 
disabled for that form. I've patched my cforms.js so that it disables 
AJAX only if the file field contains a value. Is this valid?

On a more general note would it not be possible to check only the 
fields which are to be refreshed on that browser update before deciding 
whether a full page update is needed, or am I misunderstanding 
something?

Thanks,

Robin


Re: AJAX and upload field

Posted by Robin Wyles <ro...@robinwyles.com>.
Forgot the patch...


Re: AJAX and upload field

Posted by Robin Wyles <ro...@robinwyles.com>.
Sylvain,

On 6 Dec 2005, at 12:20, Sylvain Wallez wrote:

> Robin Wyles wrote:
>> Hi All,
>>
>> I noticed that if a form contains a file field then AJAX is 
>> completely disabled for that form. I've patched my cforms.js so that 
>> it disables AJAX only if the file field contains a value. Is this 
>> valid?
>
> Yes, definitely.

Shall I put the patch on JIRA? It's very small - I attached it to this 
mail.

>
>> On a more general note would it not be possible to check only the 
>> fields which are to be refreshed on that browser update before 
>> deciding whether a full page update is needed, or am I 
>> misunderstanding something?
>
> Full page reload only occurs when we exit form.showForm(). Other than 
> that, only partial updates are sent back to the browser.

I understand, I think, but in my form it doesn't seem to work that way 
(this is with a file field).

I have something like...

<fd:group id="group1">
	<fd:widgets>
		<fd:upload id="upload"/>
		[...]
	</fd:widgets>
</fd:group>

<fd:booleanfield id="boolean">
	<fd:on-value-changed>
		<fd:javascript>
		  // toggle group2 visibility
		</fd:javascript>
	</fd:on-value-changed>
</fd:booleanfield>

<fd:group id="group2">
	<fd:widgets>
		<fd:field id="field1"/>
		[...]
		<fd:field id="field10"/>
	</fd:widgets>
</fd:group>

Using the boolean field to toggle group2 works fine with my patch as 
long as the upload field doesn't have a value. However when it does 
have a value the whole page is refreshed even though only group1 
contains the upload field and it is group2 that is the subject of the 
browser update. Also after toggling the area again after a full page 
refresh I notice that the value is removed from my file field. Is there 
something I missed?

Thanks,

Robin


Re: AJAX and upload field

Posted by Sylvain Wallez <sy...@apache.org>.
Robin Wyles wrote:
> Hi All,
>
> I noticed that if a form contains a file field then AJAX is completely 
> disabled for that form. I've patched my cforms.js so that it disables 
> AJAX only if the file field contains a value. Is this valid?

Yes, definitely.

> On a more general note would it not be possible to check only the 
> fields which are to be refreshed on that browser update before 
> deciding whether a full page update is needed, or am I 
> misunderstanding something?

Full page reload only occurs when we exit form.showForm(). Other than 
that, only partial updates are sent back to the browser.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://bluxte.net                     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director