File Upload

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

File Upload


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Sebastia Van Lacke
Hello people,
 
I am working on a form containing some text inputs and a fileUpload input, and finally a submit button to send all the data.
I would like to display the file uploaded link before the user send the complete form. So I asume that there will be two forms. One inside the onother.
The internal form only for submit the file and show it to the user.
The problem is that when the user submit the form with all the data, the fileUpload callback is evaluated for second time, with value nil , and lost the file.
 
I need something like this:
 
textInput
textInput
textArea input
fileUpload input - upload button
display the uploaded file link
 
submit button
 
what is the correct way to address this problem?
 
Thanks,
 
Sebastian
Reply | Threaded
Open this post in threaded view
|

jQuery html rendering

Robert Sirois
clickFunctionNew: html
        ^((html jQuery: '#newArea') html: [:r | r render: ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).

Could someone please explain to me why this does not work? If I replace the class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs fine. Am I to understand that I cannot render components (the aforementioned class is a WAComponent subclass with the proper 'renderContentOn:' method) like a can do with standard Seaside callbacks?

Thanks!

RS


Windows Live™: Keep your life in sync. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

jQuery

Robert Sirois
In reply to this post by Sebastia Van Lacke
Ok, I know everyone is sick of these jQuery threads, but I'm figuring it out! I got radio groups/buttons, and text inputs to work with this or similar syntax, and I've played around with the following quite a bit, but I seem to be missing something key :p


    html checkbox
        callback: [save result add: self item];
        onSelect: (html jQuery ajax serializeThis);
        value: self item.

I would appreciate any input on the matter :)

Thanks,
RS


Insert movie times and more without leaving Hotmail®. See how.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html rendering

Julian Fitzell-2
In reply to this post by Robert Sirois
Components are persistent objects. You can't create them on the fly as
throw-aways (in particular they need to be returned from your
#children method). See the recent discussion about components,
painters, and renderable objects on this list.

You either need to create the component earlier and store it somewhere
or not use a component here (if you don't need the object to persist,
you don't need a component).

Julian

On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<[hidden email]> wrote:

> clickFunctionNew: html
>         ^((html jQuery: '#newArea') html: [:r | r render:
> ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
>
> Could someone please explain to me why this does not work? If I replace the
> class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
> fine. Am I to understand that I cannot render components (the aforementioned
> class is a WAComponent subclass with the proper 'renderContentOn:' method)
> like a can do with standard Seaside callbacks?
>
> Thanks!
>
> RS
>
> ________________________________
> Windows Live™: Keep your life in sync. Check it out.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery

Lukas Renggli
In reply to this post by Robert Sirois
> Ok, I know everyone is sick of these jQuery threads, but I'm figuring it
> out! I got radio groups/buttons, and text inputs to work with this or
> similar syntax, and I've played around with the following quite a bit, but I
> seem to be missing something key :p

Not at all, please keep the questions flowing.

>     html checkbox
>         callback: [save result add: self item];
>         onSelect: (html jQuery ajax >   );
>         value: self item.

Please read the comment in JQAjax>>#serializeThis that answers this
very question in details:

serializeThis
        "Serialize the receiving element. Note that this might not work for
all form elements: (1) for check-boxes and multi-select lists Seaside
internally depends on an additional hidden form element that is
generated automatically, instead use #serializeThisWithHidden (2)
submit-button callbacks are ignored, instead use a normal callback to
trigger specific code evaluation."

        self serialize: owner canvas jQuery this

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery

Robert Sirois
I don't seem to have the same version on jQuery. My #serializeThis method looks like:

serializeThis
    "Serialize the receiving element."

    self serialize: owner canvas jQuery this

I can't seem to find a #serializeThisWithHidden method either. I am developing on Seaside 2.9 alpha 3.

Thanks,
RS

> Date: Sun, 12 Jul 2009 09:47:30 +0200
> Subject: Re: [Seaside] jQuery
> From: [hidden email]
> To: [hidden email]
>
> > Ok, I know everyone is sick of these jQuery threads, but I'm figuring it
> > out! I got radio groups/buttons, and text inputs to work with this or
> > similar syntax, and I've played around with the following quite a bit, but I
> > seem to be missing something key :p
>
> Not at all, please keep the questions flowing.
>
> >     html checkbox
> >         callback: [save result add: self item];
> >         onSelect: (html jQuery ajax > );
> >         value: self item.
>
> Please read the comment in JQAjax>>#serializeThis that answers this
> very question in details:
>
> serializeThis
> "Serialize the receiving element. Note that this might not work for
> all form elements: (1) for check-boxes and multi-select lists Seaside
> internally depends on an additional hidden form element that is
> generated automatically, instead use #serializeThisWithHidden (2)
> submit-button callbacks are ignored, instead use a normal callback to
> trigger specific code evaluation."
>
> self serialize: owner canvas jQuery this
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Windows Live™: Keep your life in sync. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery

Lukas Renggli
> I can't seem to find a #serializeThisWithHidden method either. I am
> developing on Seaside 2.9 alpha 3.

There were some bugs and some missing things in JQuery of Seaside
2.9a3. This has been fixed shortly after. I know, we should really do
a Seaside 2.9b1 soon.

In the meantime you could use the package LoadOrderTests to load the
latest code into a fresh image, or try to load the #serialize...
methods from the latest version of JQuery-Core into your code base
(loading the full package does not work in Seaside 2.9a3).

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery

Robert Sirois
Ah, ok. I'll try one of those workarounds. I'm excited for Seaside 2.9 beta and Gemstone :)

RS

> Date: Sun, 12 Jul 2009 16:56:47 +0200
> Subject: Re: [Seaside] jQuery
> From: [hidden email]
> To: [hidden email]
>
> > I can't seem to find a #serializeThisWithHidden method either. I am
> > developing on Seaside 2.9 alpha 3.
>
> There were some bugs and some missing things in JQuery of Seaside
> 2.9a3. This has been fixed shortly after. I know, we should really do
> a Seaside 2.9b1 soon.
>
> In the meantime you could use the package LoadOrderTests to load the
> latest code into a fresh image, or try to load the #serialize...
> methods from the latest version of JQuery-Core into your code base
> (loading the full package does not work in Seaside 2.9a3).
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Windows Live™: Keep your life in sync. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html rendering

Robert Sirois
In reply to this post by Julian Fitzell-2
Thanks, Julian. I am a bit confused, though.

    html anchor
        onClick: ((html jQuery: '#contentArea') html: [:r | r render: (RPSSCreator new)]);
        with: 'Create a new survey'.

I have been using code like this in a few areas, and it works just fine. The object just needs to persist until it does its job, then I can move along in whatever process.

I can't seem to get some of my components to render in this way... I get: 'MessageNotUnderstood: RPSSSurveyItemComponent>>nil'. As far as I can tell, there is nothing different about it (than the others), and I am not sending any messages to it except #new. WACounter, etc. work fine in its place.

As far as #children goes, I havn't been including everything there because the page is remaining relatively static. 'RPSSSurveyItemComponent' is a WAComponent subclass, but I'm just using it to generate survey components, so for each new survey item I will need a new instance.

Is lazy initializing good enough for creating these objects in advance when it comes to jQuery?

Thanks,
RS

> Date: Sun, 12 Jul 2009 08:22:03 +0100
> Subject: Re: [Seaside] jQuery html rendering
> From: [hidden email]
> To: [hidden email]
>
> Components are persistent objects. You can't create them on the fly as
> throw-aways (in particular they need to be returned from your
> #children method). See the recent discussion about components,
> painters, and renderable objects on this list.
>
> You either need to create the component earlier and store it somewhere
> or not use a component here (if you don't need the object to persist,
> you don't need a component).
>
> Julian
>
> On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<[hidden email]> wrote:
> > clickFunctionNew: html
> >         ^((html jQuery: '#newArea') html: [:r | r render:
> > ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
> >
> > Could someone please explain to me why this does not work? If I replace the
> > class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
> > fine. Am I to understand that I cannot render components (the aforementioned
> > class is a WAComponent subclass with the proper 'renderContentOn:' method)
> > like a can do with standard Seaside callbacks?
> >
> > Thanks!
> >
> > RS
> >
> > ________________________________
> > Windows Live™: Keep your life in sync. Check it out.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Lauren found her dream laptop. Find the PC that’s right for you.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html rendering

Robert Sirois
Oh, I get it. If I render something that doesn't return anything, of course there would be nothing to render.

If I have a class with #renderContentOn: then that would called as part of the render loop when it is loaded into the document. Is this correct or am I going crazy? Actually, I just tried that and it doesn't work...

Thanks,
RS


From: [hidden email]
To: [hidden email]
Subject: RE: [Seaside] jQuery html rendering
Date: Sun, 12 Jul 2009 12:18:49 -0600

Thanks, Julian. I am a bit confused, though.

    html anchor
        onClick: ((html jQuery: '#contentArea') html: [:r | r render: (RPSSCreator new)]);
        with: 'Create a new survey'.

I have been using code like this in a few areas, and it works just fine. The object just needs to persist until it does its job, then I can move along in whatever process.

I can't seem to get some of my components to render in this way... I get: 'MessageNotUnderstood: RPSSSurveyItemComponent>>nil'. As far as I can tell, there is nothing different about it (than the others), and I am not sending any messages to it except #new. WACounter, etc. work fine in its place.

As far as #children goes, I havn't been including everything there because the page is remaining relatively static. 'RPSSSurveyItemComponent' is a WAComponent subclass, but I'm just using it to generate survey components, so for each new survey item I will need a new instance.

Is lazy initializing good enough for creating these objects in advance when it comes to jQuery?

Thanks,
RS

> Date: Sun, 12 Jul 2009 08:22:03 +0100
> Subject: Re: [Seaside] jQuery html rendering
> From: [hidden email]
> To: [hidden email]
>
> Components are persistent objects. You can't create them on the fly as
> throw-aways (in particular they need to be returned from your
> #children method). See the recent discussion about components,
> painters, and renderable objects on this list.
>
> You either need to create the component earlier and store it somewhere
> or not use a component here (if you don't need the object to persist,
> you don't need a component).
>
> Julian
>
> On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<[hidden email]> wrote:
> > clickFunctionNew: html
> >         ^((html jQuery: '#newArea') html: [:r | r render:
> > ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
> >
> > Could someone please explain to me why this does not work? If I replace the
> > class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
> > fine. Am I to understand that I cannot render components (the aforementioned
> > class is a WAComponent subclass with the proper 'renderContentOn:' method)
> > like a can do with standard Seaside callbacks?
> >
> > Thanks!
> >
> > RS
> >
> > ________________________________
> > Windows Live™: Keep your life in sync. Check it out.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Lauren found her dream laptop. Find the PC that’s right for you.

Lauren found her dream laptop. Find the PC that’s right for you.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html rendering

Julian Fitzell-2
In reply to this post by Robert Sirois
It may work sometimes, but certain things will not work. #updateRoot:
for example, will not be called for that component or any component
contained within it. In 2.8, I think callbacks won't work for those
components.

Even lazy initialization is not really good enough - it may work
sometimes but updateRoot: and others certainly won't be called during
the first request. Also, you shouldn't modify backtracked component
state during rendering, so you may need to be careful there when using
lazy initialization too (off the top of my head, I can't remember if
that same restriction applies during javascript rendering callbacks,
though - it may not).

I'm not certain that these things are causing your problems, but it's
the most obvious thing that jumps out at me. If you aren't persisting
the components, you really don't need a component. In 2.9, make a
subclass of WAPainter instead - those don't need to be persisted. In
2.8, you could try just subclassing Object and implementing #renderOn:
but it may or may not give you everything you need.

If making that change fixes your problem (or you discover that you
*do* need components and therefor *do* need to be persisting them)
then we've found the issue. Otherwise, if you prepare a simple example
that we can file in and debug someone may be able to help further.

Julian

On Sun, Jul 12, 2009 at 7:18 PM, Robert Sirois<[hidden email]> wrote:

> Thanks, Julian. I am a bit confused, though.
>
>     html anchor
>         onClick: ((html jQuery: '#contentArea') html: [:r | r render:
> (RPSSCreator new)]);
>         with: 'Create a new survey'.
>
> I have been using code like this in a few areas, and it works just fine. The
> object just needs to persist until it does its job, then I can move along in
> whatever process.
>
> I can't seem to get some of my components to render in this way... I get:
> 'MessageNotUnderstood: RPSSSurveyItemComponent>>nil'. As far as I can tell,
> there is nothing different about it (than the others), and I am not sending
> any messages to it except #new. WACounter, etc. work fine in its place.
>
> As far as #children goes, I havn't been including everything there because
> the page is remaining relatively static. 'RPSSSurveyItemComponent' is a
> WAComponent subclass, but I'm just using it to generate survey components,
> so for each new survey item I will need a new instance.
>
> Is lazy initializing good enough for creating these objects in advance when
> it comes to jQuery?
>
> Thanks,
> RS
>
>> Date: Sun, 12 Jul 2009 08:22:03 +0100
>> Subject: Re: [Seaside] jQuery html rendering
>> From: [hidden email]
>> To: [hidden email]
>>
>> Components are persistent objects. You can't create them on the fly as
>> throw-aways (in particular they need to be returned from your
>> #children method). See the recent discussion about components,
>> painters, and renderable objects on this list.
>>
>> You either need to create the component earlier and store it somewhere
>> or not use a component here (if you don't need the object to persist,
>> you don't need a component).
>>
>> Julian
>>
>> On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<[hidden email]>
>> wrote:
>> > clickFunctionNew: html
>> >         ^((html jQuery: '#newArea') html: [:r | r render:
>> > ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
>> >
>> > Could someone please explain to me why this does not work? If I replace
>> > the
>> > class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
>> > fine. Am I to understand that I cannot render components (the
>> > aforementioned
>> > class is a WAComponent subclass with the proper 'renderContentOn:'
>> > method)
>> > like a can do with standard Seaside callbacks?
>> >
>> > Thanks!
>> >
>> > RS
>> >
>> > ________________________________
>> > Windows Live™: Keep your life in sync. Check it out.
>> > _______________________________________________
>> > seaside mailing list
>> > [hidden email]
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> ________________________________
> Lauren found her dream laptop. Find the PC that’s right for you.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html rendering

Robert Sirois
Does anyone have any advice for this scenario:

Updating one object via an ajax form, but with the ability to create new form elements on the fly.

It should work a little like this:

I fill out a form input, hit a button, and another appears. Fill out the new one, hit a button, etc., etc. Each time the button is pushed that element would be saved.

Thanks,
RS

> Date: Sun, 12 Jul 2009 22:09:03 +0100
> Subject: Re: [Seaside] jQuery html rendering
> From: [hidden email]
> To: [hidden email]
>
> It may work sometimes, but certain things will not work. #updateRoot:
> for example, will not be called for that component or any component
> contained within it. In 2.8, I think callbacks won't work for those
> components.
>
> Even lazy initialization is not really good enough - it may work
> sometimes but updateRoot: and others certainly won't be called during
> the first request. Also, you shouldn't modify backtracked component
> state during rendering, so you may need to be careful there when using
> lazy initialization too (off the top of my head, I can't remember if
> that same restriction applies during javascript rendering callbacks,
> though - it may not).
>
> I'm not certain that these things are causing your problems, but it's
> the most obvious thing that jumps out at me. If you aren't persisting
> the components, you really don't need a component. In 2.9, make a
> subclass of WAPainter instead - those don't need to be persisted. In
> 2.8, you could try just subclassing Object and implementing #renderOn:
> but it may or may not give you everything you need.
>
> If making that change fixes your problem (or you discover that you
> *do* need components and therefor *do* need to be persisting them)
> then we've found the issue. Otherwise, if you prepare a simple example
> that we can file in and debug someone may be able to help further.
>
> Julian
>
> On Sun, Jul 12, 2009 at 7:18 PM, Robert Sirois<[hidden email]> wrote:
> > Thanks, Julian. I am a bit confused, though.
> >
> >     html anchor
> >         onClick: ((html jQuery: '#contentArea') html: [:r | r render:
> > (RPSSCreator new)]);
> >         with: 'Create a new survey'.
> >
> > I have been using code like this in a few areas, and it works just fine. The
> > object just needs to persist until it does its job, then I can move along in
> > whatever process.
> >
> > I can't seem to get some of my components to render in this way... I get:
> > 'MessageNotUnderstood: RPSSSurveyItemComponent>>nil'. As far as I can tell,
> > there is nothing different about it (than the others), and I am not sending
> > any messages to it except #new. WACounter, etc. work fine in its place.
> >
> > As far as #children goes, I havn't been including everything there because
> > the page is remaining relatively static. 'RPSSSurveyItemComponent' is a
> > WAComponent subclass, but I'm just using it to generate survey components,
> > so for each new survey item I will need a new instance.
> >
> > Is lazy initializing good enough for creating these objects in advance when
> > it comes to jQuery?
> >
> > Thanks,
> > RS
> >
> >> Date: Sun, 12 Jul 2009 08:22:03 +0100
> >> Subject: Re: [Seaside] jQuery html rendering
> >> From: [hidden email]
> >> To: [hidden email]
> >>
> >> Components are persistent objects. You can't create them on the fly as
> >> throw-aways (in particular they need to be returned from your
> >> #children method). See the recent discussion about components,
> >> painters, and renderable objects on this list.
> >>
> >> You either need to create the component earlier and store it somewhere
> >> or not use a component here (if you don't need the object to persist,
> >> you don't need a component).
> >>
> >> Julian
> >>
> >> On Sun, Jul 12, 2009 at 12:25 AM, Robert Sirois<[hidden email]>
> >> wrote:
> >> > clickFunctionNew: html
> >> >         ^((html jQuery: '#newArea') html: [:r | r render:
> >> > ((RPSSSurveyItemComponent new) newInputOn: self inputType; yourself)]).
> >> >
> >> > Could someone please explain to me why this does not work? If I replace
> >> > the
> >> > class 'RPSSSurveyItemComponent' with some like a string 'blah', it runs
> >> > fine. Am I to understand that I cannot render components (the
> >> > aforementioned
> >> > class is a WAComponent subclass with the proper 'renderContentOn:'
> >> > method)
> >> > like a can do with standard Seaside callbacks?
> >> >
> >> > Thanks!
> >> >
> >> > RS
> >> >
> >> > ________________________________
> >> > Windows Live™: Keep your life in sync. Check it out.
> >> > _______________________________________________
> >> > seaside mailing list
> >> > [hidden email]
> >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >> >
> >> >
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > ________________________________
> > Lauren found her dream laptop. Find the PC that’s right for you.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Lauren found her dream laptop. Find the PC that’s right for you.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside