Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 65034 invoked from network); 6 Dec 2005 11:50:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Dec 2005 11:50:06 -0000 Received: (qmail 16180 invoked by uid 500); 6 Dec 2005 11:49:49 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 16084 invoked by uid 500); 6 Dec 2005 11:49:48 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 16057 invoked by uid 99); 6 Dec 2005 11:49:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2005 03:49:48 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [194.109.24.22] (HELO smtp-vbr2.xs4all.nl) (194.109.24.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2005 03:49:47 -0800 Received: from [192.168.1.15] (a80-126-53-97.adsl.xs4all.nl [80.126.53.97]) by smtp-vbr2.xs4all.nl (8.13.3/8.13.3) with ESMTP id jB6BnO4M051789 for ; Tue, 6 Dec 2005 12:49:25 +0100 (CET) (envelope-from rob@robinwyles.com) Mime-Version: 1.0 (Apple Message framework v623) In-Reply-To: References: <7ccb763048ad18a226701a45664c2e44@robinwyles.com> <439573EE.7090508@apache.org> Content-Type: multipart/mixed; boundary=Apple-Mail-10-943960719 Message-Id: <4d4850dc4c80b582a9b70eca444e0049@robinwyles.com> From: Robin Wyles Subject: Re: AJAX and upload field Date: Tue, 6 Dec 2005 12:53:03 +0100 To: dev@cocoon.apache.org X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --Apple-Mail-10-943960719 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Forgot the patch... --Apple-Mail-10-943960719 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="cforms-upload.patch" Content-Disposition: attachment; filename=cforms-upload.patch Index: /Users/robinwyles/Work/COCOON_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/js/cforms.js =================================================================== --- /Users/robinwyles/Work/COCOON_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/js/cforms.js (revision 354055) +++ /Users/robinwyles/Work/COCOON_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/js/cforms.js (working copy) @@ -116,8 +116,12 @@ continue; } if (input.type == "file") { - // Can't send files in Ajax mode. Fall back to full page - return null; + if (!input.value) { + continue; + } else { + // Can't send files in Ajax mode. Fall back to full page + return null; + } } if (input.tagName.toLowerCase() == "select" && input.multiple) { var name = encodeURIComponent(input.name); --Apple-Mail-10-943960719 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 6 Dec 2005, at 12:51, Robin Wyles wrote: > 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... > > > > > [...] > > > > > > > // toggle group2 visibility > > > > > > > > [...] > > > > > 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 --Apple-Mail-10-943960719--