cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Wyles <...@robinwyles.com>
Subject Re: AJAX and upload field
Date Tue, 06 Dec 2005 11:51:38 GMT
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


Mime
View raw message