JQuery dialog radio buttons

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

JQuery dialog radio buttons

Ramiro Diaz Trepat-2
Hi there,
I have a JQuery dialog, which is a simple form composed of radio buttons.  Each of those radio buttons has a #callback: block, that never gets called.
The code that creates the radiobuttons looks something like this:
html listItem
with: [html radioButton 
group: group;
callback: [self newTemplate: template];
with: [
html label: template name.
html paragraph: template description]]].


I saw a similar example in:
JQFormFunctionalTest>>renderRadioButtonOn: html

where radio buttons have a callback as well, and in this case the #callback: block does get called each time you change the radio button selection.
Is there is anything particular to take care of for the callbacks to work inside a JQuery Dialog?
In the example, the execution of the rendering in the #onChanged:  triggers the #callback: of the radio buttons?
Thanks


r

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

Re: JQuery dialog radio buttons

Julian Fitzell-2
I think if you look in JQFormFunctionalTest's
#renderLabel:control:model:on:, you'll see that it is outputing
javascript that serializes the form fields... seems kind of
complicated though for what you want. I imagine you can just do
something like (untested):

html radioButton
   group: group;
   onChange: (html jQuery ajax callback: [ ... ]);
   with: [...]

Julian

On Sun, Dec 27, 2009 at 9:37 PM, Ramiro Diaz Trepat
<[hidden email]> wrote:

> Hi there,
> I have a JQuery dialog, which is a simple form composed of radio buttons.
>  Each of those radio buttons has a #callback: block, that never gets called.
> The code that creates the radiobuttons looks something like this:
> html listItem
> with: [html radioButton
> group: group;
> callback: [self newTemplate: template];
> with: [
> html label: template name.
> html paragraph: template description]]].
>
> I saw a similar example in:
> JQFormFunctionalTest>>renderRadioButtonOn: html
> where radio buttons have a callback as well, and in this case the #callback:
> block does get called each time you change the radio button selection.
> Is there is anything particular to take care of for the callbacks to work
> inside a JQuery Dialog?
> In the example, the execution of the rendering in the #onChanged:  triggers
> the #callback: of the radio buttons?
> Thanks
>
> r
> _______________________________________________
> 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 dialog radio buttons

Lukas Renggli
> I think if you look in JQFormFunctionalTest's
> #renderLabel:control:model:on:, you'll see that it is outputing
> javascript that serializes the form fields... seems kind of
> complicated though for what you want. I imagine you can just do
> something like (untested):

Yeah, this is a bit complicated because it tries to render all
possible form controls using the same method.

> html radioButton
>   group: group;
>   onChange: (html jQuery ajax callback: [ ... ]);
>   with: [...]

The simplest is if you serialize the complete form. For example if you
register the following script for change events on each form element

     html jQuery ajax serializeForm

you will trigger all callbacks of the enclosing form whenever
something changes, essentially keeping the form persistent all the
time.

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 dialog radio buttons

Ramiro Diaz Trepat-2
Thank you very much for your replies.
Evidently there's still quite a few basic things I don't know about ajax / jQuery.  
What is (conceptually) #serializeForm, in what situations should be used?
By the way, if I try adding this simiple onChange: to the radio buttons, I still don't get the callbacks' block to be called.

html radioButton 
group: group;
callback: [self newSimulationTemplate: template];
onChange: (html jQuery ajax serializeForm);
with: [
.....

May be Lukas meant something different?
Cheers


r


On Mon, Dec 28, 2009 at 9:57 AM, Lukas Renggli <[hidden email]> wrote:
> I think if you look in JQFormFunctionalTest's
> #renderLabel:control:model:on:, you'll see that it is outputing
> javascript that serializes the form fields... seems kind of
> complicated though for what you want. I imagine you can just do
> something like (untested):

Yeah, this is a bit complicated because it tries to render all
possible form controls using the same method.

> html radioButton
>   group: group;
>   onChange: (html jQuery ajax callback: [ ... ]);
>   with: [...]

The simplest is if you serialize the complete form. For example if you
register the following script for change events on each form element

    html jQuery ajax serializeForm

you will trigger all callbacks of the enclosing form whenever
something changes, essentially keeping the form persistent all the
time.

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: JQuery dialog radio buttons

Lukas Renggli
No, that looks ok. Do you have a form-tag around your elements.

The #serialize: method sends the form elemnts to the server and
triggers the callbacks. The argument is a query selecting the elements
to be serialized. The #serialize... methods are just convenience
methods with the most used queries (see method comment).

Lukas

On Monday, December 28, 2009, Ramiro Diaz Trepat <[hidden email]> wrote:

> Thank you very much for your replies.Evidently there's still quite a few basic things I don't know about ajax / jQuery.  What is (conceptually) #serializeForm, in what situations should be used?
> By the way, if I try adding this simiple onChange: to the radio buttons, I still don't get the callbacks' block to be called.
> html radioButton  group: group;
> callback: [self newSimulationTemplate: template]; onChange: (html jQuery ajax serializeForm);
> with: [.....
> May be Lukas meant something different?Cheers
>
> r
>
>
> On Mon, Dec 28, 2009 at 9:57 AM, Lukas Renggli <[hidden email]> wrote:
>
>> I think if you look in JQFormFunctionalTest's
>> #renderLabel:control:model:on:, you'll see that it is outputing
>> javascript that serializes the form fields... seems kind of
>> complicated though for what you want. I imagine you can just do
>> something like (untested):
>
> Yeah, this is a bit complicated because it tries to render all
> possible form controls using the same method.
>
>> html radioButton
>>   group: group;
>>   onChange: (html jQuery ajax callback: [ ... ]);
>>   with: [...]
>
> The simplest is if you serialize the complete form. For example if you
> register the following script for change events on each form element
>
>      html jQuery ajax serializeForm
>
> you will trigger all callbacks of the enclosing form whenever
> something changes, essentially keeping the form persistent all the
> time.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>

--
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 dialog radio buttons

Ramiro Diaz Trepat-2
That worked like a charm.  Building up my silly dialog from the examples, I missed the form that the jQuery dialog example don't use!
Sorry for the basic questions and thanks again to both.
Cheers

r


On Mon, Dec 28, 2009 at 1:00 PM, Lukas Renggli <[hidden email]> wrote:
No, that looks ok. Do you have a form-tag around your elements.

The #serialize: method sends the form elemnts to the server and
triggers the callbacks. The argument is a query selecting the elements
to be serialized. The #serialize... methods are just convenience
methods with the most used queries (see method comment).

Lukas

On Monday, December 28, 2009, Ramiro Diaz Trepat <[hidden email]> wrote:
> Thank you very much for your replies.Evidently there's still quite a few basic things I don't know about ajax / jQuery.  What is (conceptually) #serializeForm, in what situations should be used?
> By the way, if I try adding this simiple onChange: to the radio buttons, I still don't get the callbacks' block to be called.
> html radioButton      group: group;
>       callback: [self newSimulationTemplate: template];       onChange: (html jQuery ajax serializeForm);
>       with: [.....
> May be Lukas meant something different?Cheers
>
> r
>
>
> On Mon, Dec 28, 2009 at 9:57 AM, Lukas Renggli <[hidden email]> wrote:
>
>> I think if you look in JQFormFunctionalTest's
>> #renderLabel:control:model:on:, you'll see that it is outputing
>> javascript that serializes the form fields... seems kind of
>> complicated though for what you want. I imagine you can just do
>> something like (untested):
>
> Yeah, this is a bit complicated because it tries to render all
> possible form controls using the same method.
>
>> html radioButton
>>   group: group;
>>   onChange: (html jQuery ajax callback: [ ... ]);
>>   with: [...]
>
> The simplest is if you serialize the complete form. For example if you
> register the following script for change events on each form element
>
>      html jQuery ajax serializeForm
>
> you will trigger all callbacks of the enclosing form whenever
> something changes, essentially keeping the form persistent all the
> time.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>

--
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