[Seaside] Not able to upload [a Seaside.WAFile] through onClick

Andrius Paulavicius apaulavicius at gmail.com
Thu Sep 20 14:56:37 UTC 2007

I just do something like:

    html iframe name: 'fileupload';
    html form
        attributeAt: 'target' put: 'fileupload';
        with: [
            html fileUpload callback: [:f | file := f].
            html submitButton 
            onClick: (html evaluator callback:  [:script | 
                self validateFile.
                self updateErrorMesage: script]);
        text: 'upload'].

I hide the iframe by setting its style to 
    height: 0;
    width: 0;
    border-style: none;

doe's uploading without refreshing the rest of the page and seems to work 
in both firefox and ie
----- Original Message ----- 
From: "Lukas Renggli" <renggli at gmail.com>
To: "Seaside - general discussion" <seaside at lists.squeakfoundation.org>
Sent: Thursday, September 20, 2007 11:43 AM
Subject: Re: [Seaside] Not able to upload [a Seaside.WAFile] through onClick

>> Below is my attempt to implement Lukas's code but it is not recognising
>> submit, any ideas?
> 1. Do never nest forms. This won't work and will lead to all kind of
> strange problems (different ones in different browsers).
> 2. You don't need the submit button, as the form is automatically
> submitted when the user selects a file. This automatically causes a
> full refresh.
>> How would I implement Andrius's code?
> This involves some JavaScript programming, that is actually very
> similar to the code used in the (totally unrelated) Comet package.
> 1. You create a named IFRAME that you hide somewhere on your page
> (move it somewhere outside the visible viewport, fully hiding the
> thing breaks some browsers).
> 2. You assign an onLoad event to the IFRAME that updates the part of
> the page after the successful upload.
> 3. As presented you set the target of your form to the IFRAME.
> Combined with the #onChange: on the file-upload you don't even need a
> submit button.
> Lukas
> -- 
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list