updating form element value

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

updating form element value

Sebastian Sastre-2
Hi there,
 
    is possible to use an updater to bring a value from some form element in the user agent in the updater's request? Some clue on how to achieve this?
 
    I think that using something like that we can create a MVC or MVP set of components right to the ajax level wich gives interactivity of controls to a interesting level,
 
    thanks,
 

Sebastian Sastre

 

 

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

RE: updating form element value

Ramon Leon-5
> Hi there,
>  
>     is possible to use an updater to bring a value from some
> form element in the user agent in the updater's request? Some
> clue on how to achieve this?
>  
>     I think that using something like that we can create a
> MVC or MVP set of components right to the ajax level wich
> gives interactivity of controls to a interesting level,
>  
>     thanks,
>  
> Sebastian Sastre

Care to be more specific?

Ramon Leon
http://onsmalltalk.com 

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

RE: updating form element value

Sebastian Sastre-2
I wish to be able to receive the value of some form element in the server
side pretty much like in place editor does but also update other element.
This could be made hooking an event #change to react with the update but
that generates an executor and an updater, so I was wondering if that can be
made just with an updater in one http request instead of two.

Was I clearer than before?

Sebastian Sastre


> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Ramon Leon
> Enviado el: Jueves, 27 de Septiembre de 2007 22:40
> Para: 'Seaside - general discussion'
> Asunto: RE: [Seaside] updating form element value
>
> > Hi there,
> >  
> >     is possible to use an updater to bring a value from some form
> > element in the user agent in the updater's request? Some
> clue on how
> > to achieve this?
> >  
> >     I think that using something like that we can create a
> MVC or MVP
> > set of components right to the ajax level wich gives
> interactivity of
> > controls to a interesting level,
> >  
> >     thanks,
> >  
> > Sebastian Sastre
>
> Care to be more specific?
>
> Ramon Leon
> http://onsmalltalk.com 
>
> _______________________________________________
> 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: updating form element value

Lukas Renggli
> I wish to be able to receive the value of some form element in the server
> side pretty much like in place editor does but also update other element.
> This could be made hooking an event #change to react with the update but
> that generates an executor and an updater, so I was wondering if that can be
> made just with an updater in one http request instead of two.
>
> Was I clearer than before?

Not quite sure what you mean, but the method #callback:value: and some
of the convenience methods that call it might help you? You can have
multiple #callback:value: calls per request and they works with all
subclasses of SUAjax.

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: updating form element value

Sebastian Sastre-2
Dear Lukas,

        I think that the #callback:value: should help yes. Right now I have
a reaction renderer like this:

  [:html|
                html updater
                        id: self id;
                        callback:[:v :h|
                                (self at: aSymbol) model setValue: v.
                                self renderInnerContentOn: h]
                        value: (html formElement  
                                                id: (self at: aSymbol)
inputElementId;
                                                value)]

        Look at the callback. I've put as first argument :v  which is
correctly returning an input text value when the #change event actually
happens in the UA, but I'm not receiving the canvas in :h  so it's nil. So
I'm unable to perform an update of the content. I think it was possible to
receive the value and the canvas to make the update, maybe I misunderstood
something?

        cheers,

Sebastian Sastre
PS1: the "self at: aSymbol" just returns a subcomponent which basically is
an html InputText tied to a model
PS2: the "(self at: aSymbol) inputElementId" returns the id of the inputText
tag of the form element.
PS3: "self id" is the id of the component and the id of the div tag that
wrapps the html rendered by the component

 

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Lukas Renggli
> Enviado el: Viernes, 28 de Septiembre de 2007 12:23
> Para: Seaside - general discussion
> Asunto: Re: [Seaside] updating form element value
>
> > I wish to be able to receive the value of some form element in the
> > server side pretty much like in place editor does but also
> update other element.
> > This could be made hooking an event #change to react with
> the update
> > but that generates an executor and an updater, so I was
> wondering if
> > that can be made just with an updater in one http request
> instead of two.
> >
> > Was I clearer than before?
>
> Not quite sure what you mean, but the method #callback:value:
> and some of the convenience methods that call it might help
> you? You can have multiple #callback:value: calls per request
> and they works with all subclasses of SUAjax.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> 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: updating form element value

Lukas Renggli
>         Look at the callback. I've put as first argument :v  which is
> correctly returning an input text value when the #change event actually
> happens in the UA, but I'm not receiving the canvas in :h  so it's nil. So
> I'm unable to perform an update of the content. I think it was possible to
> receive the value and the canvas to make the update, maybe I misunderstood
> something?

#callback:value: is not supposed to get a renderer passed in, just the
value. Use the common #callback: to get the renderer. Check out the
documentation in those two methods.

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: updating form element value

Sebastian Sastre-2
Lukas,

        I supouse I've tested it after a long day of work. Now I've changed
the previous renderer to this:

        ^ [:html|
                html updater
                        id: self id;
                        callback:[:h| self renderInnerContentOn: h];
                        callback:[:v | (self at: aSymbol) model setValue: v]
                        value: (html formElement  
                                                id: (self at: aSymbol)
inputElementId;
                                                value)]

        and it does exactly what I was wanting to do.

        thanks a lot for the assistance,

Sebastian Sastre
PS: one key is that one can set the main #callback: (in which the updater
receives the canvas) *and* then N #callback:value: per suajax this was new
for me.

> > it's nil. So I'm unable to perform an update of the
> content. I think
> > it was possible to receive the value and the canvas to make the
> > update, maybe I misunderstood something?
>
> #callback:value: is not supposed to get a renderer passed in,
> just the value. Use the common #callback: to get the
> renderer. Check out the documentation in those two methods.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> 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: updating form element value

Lukas Renggli
> PS: one key is that one can set the main #callback: (in which the updater
> receives the canvas) *and* then N #callback:value: per suajax this was new
> for me.

Yes, I see. The documentation is not all that obvious on that. Maybe
the library should also be stricter on the #numArgs of blocks.

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: updating form element value

Sebastian Sastre-2
In reply to this post by Sebastian Sastre-2
Question: How many http requests one should expect from the code of the
updater below?

Sebastian Sastre

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Sebastian Sastre
> Enviado el: Martes, 02 de Octubre de 2007 09:12
> Para: 'Seaside - general discussion'
> Asunto: RE: [Seaside] updating form element value
>
> Lukas,
>
> I supouse I've tested it after a long day of work. Now
> I've changed the previous renderer to this:
>
> ^ [:html|
> html updater
> id: self id;
> callback:[:h| self renderInnerContentOn: h];
> callback:[:v | (self at: aSymbol) model
> setValue: v]
> value: (html formElement  
> id: (self at: aSymbol)
> inputElementId;
> value)]
>
> and it does exactly what I was wanting to do.
>
> thanks a lot for the assistance,
>
> Sebastian Sastre
> PS: one key is that one can set the main #callback: (in which
> the updater receives the canvas) *and* then N
> #callback:value: per suajax this was new for me.
>
> > > it's nil. So I'm unable to perform an update of the
> > content. I think
> > > it was possible to receive the value and the canvas to make the
> > > update, maybe I misunderstood something?
> >
> > #callback:value: is not supposed to get a renderer passed
> in, just the
> > value. Use the common #callback: to get the renderer. Check out the
> > documentation in those two methods.
> >
> > Cheers,
> > Lukas
> >
> > --
> > Lukas Renggli
> > http://www.lukas-renggli.ch
> > _______________________________________________
> > 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

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

Re: updating form element value

Lukas Renggli
> Question: How many http requests one should expect from the code of the
> updater below?

> >               html updater
> >                       id: self id;
> >                       callback:[:h| self renderInnerContentOn: h];
> >                       callback:[:v | (self at: aSymbol) model
> > setValue: v]
> >                       value: (html formElement
> >                                               id: (self at: aSymbol)
> > inputElementId;
> >                                               value)]

A single one.

The following things happen:

1. A request is initiated from JavaScript.
2. The secondary callbacks (#callback:value:) are evaluated in the
order declared.
3. The primary callback (#callback:) is evaluated with a new rendering context.
4. The result of the primary callback is sent back to the client.
5. The JavaScript updates according to the new rendering.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside