How to use PTFactory>>evaluator for select list entry (beginners question)

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

How to use PTFactory>>evaluator for select list entry (beginners question)

Sabine Manaa
Hello,

Gerhard thank you for your answer!

I succeed in re-rendering ListB after selecting something new in ListA with >>renderSecondListOn:.
So, this works now.

But the second problem still remains: after changing the code from "html scriptaculous updater" to the prototype version "html prototype evaluator", the callback (self numb: value) does not fire anymore.
I need the callback for saving the selected enty in an instance variable "numb".

How can I save the selected list entry in the inst var?

Greetings
Sabine


renderListAOn: html
    html
        form: [
            html select
                id: 'listAID';
                list: #('1' '2' '3' '4' '5' '6');
                selected: numb;
                callback: [ :value |
                            'fires' inspect.
                            self numb: value ];
                onChange:
                        (html prototype evaluator
                                callback: [ :script |
                                            script prototype element
                                                id: 'formB';
                                                update: [ :renderer | self renderSecondListOn: renderer ] ];
                                return: false) ]
##############
renderListBOn: html
    html form
        id: 'formB';
        with: [
                    html select
                        id: 'listBID';
                        list: #('1' '2' '3' '4' '5' '6');
                        selected: numb ]
###############
renderSecondListOn: html
    html select
        id: 'listBID';
        list: #('1' '2' '3' '4' '5' '6' 're-rendered');
        selected: numb
 

  1. Re: How to use PTFactory>>evaluator for select list entry
     (beginners question) (Gerhard Obermann)


----------------------------------------------------------------------

Message: 1
Date: Fri, 15 Jun 2012 22:19:38 +0200
From: Gerhard Obermann <[hidden email]>
Subject: Re: [Seaside] How to use PTFactory>>evaluator for select list
       entry   (beginners question)
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <CAOB-OiDchty+cYo1oPxst9koHFxqTa2DGQOQv7T3U=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hi Sabine and welcome!

Try something like:

 script prototype element id: 'formB'; update: [:renderer | self
renderSecondListOn: renderer ].

renderSecondListOn: html
      html select
                       id: 'listBID';
                       list: #('1' '2' '3' '4' '5' '6');
                       selected: numb

Cheers
Gerhard





On Fri, Jun 15, 2012 at 12:45 PM, Sabine Knöfel <[hidden email]>wrote:

> Hello,
>
> I have 2 lists "ListA" and "ListB" and I want to follow "ListB" after
> "ListA".
> This means if I select a value in "listA", "listB" (which is in another
> Form) should update automatically.
>
> I have to use PTFactory>>evaluator, because I want to update more than one
> DOM elememts later.
>
> I succeed in *hiding* ListB after changing selection of ListA.
> But do not know what to send instead of "hide" for updating ListB with
> selection of ListA.
>
> The value to select should be stored in an instance variable "numb". This
> was working, when using "html scriptaculous updater" instead of "prototype
> evaluator". After changing the code to use evaluator, the callback does not
> work anymore.
>
> Cheers
> Sabine
> ###########
> renderListAOn: html
>     html
>         form: [
>             html select
>                 id: 'listAID';
>                 list: #('1' '2' '3' '4' '5' '6');
>                 selected: numb;
>                 callback: [ :value | self numb: value ];
>                 onChange:
>                         (html prototype evaluator
>                                 callback: [ :script |
>                                             script prototype element id:
> 'listBID'.    "hide"
>                                             numb inspect ];
>                                 return: false) ]
> ###########
> renderListBOn: html
>     html form
>         id: 'formB';
>         with: [
>                     html select
>                         id: 'listBID';
>                         list: #('1' '2' '3' '4' '5' '6');
>                         selected: numb ]
>
> _______________________________________________
 


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

Re: How to use PTFactory>>evaluator for select list entry (beginners question)

Gerhard Obermann
I think you need to trigger the form, otherwise the callbacks are not called.

1) give your form an id
2) change the onChange event to:

html prototype evaluator
triggerForm: formId;
callback: [:script |
              script prototype element
                       id: 'formB';
                       update: [ :renderer | self renderSecondListOn: renderer ]
             ]


On Mon, Jun 18, 2012 at 10:09 AM, Sabine Knöfel <[hidden email]> wrote:
Hello,

Gerhard thank you for your answer!

I succeed in re-rendering ListB after selecting something new in ListA with >>renderSecondListOn:.
So, this works now.

But the second problem still remains: after changing the code from "html scriptaculous updater" to the prototype version "html prototype evaluator", the callback (self numb: value) does not fire anymore.
I need the callback for saving the selected enty in an instance variable "numb".

How can I save the selected list entry in the inst var?

Greetings
Sabine


renderListAOn: html
    html
        form: [
            html select
                id: 'listAID';
                list: #('1' '2' '3' '4' '5' '6');
                selected: numb;
                callback: [ :value |
                            'fires' inspect.
                            self numb: value ];
                onChange:
                        (html prototype evaluator
                                callback: [ :script |
                                            script prototype element
                                                id: 'formB';
                                                update: [ :renderer | self renderSecondListOn: renderer ] ];
                                return: false) ]
##############
renderListBOn: html
    html form
        id: 'formB';
        with: [
                    html select
                        id: 'listBID';
                        list: #('1' '2' '3' '4' '5' '6');
                        selected: numb ]
###############
renderSecondListOn: html
    html select
        id: 'listBID';
        list: #('1' '2' '3' '4' '5' '6' 're-rendered');
        selected: numb
 

  1. Re: How to use PTFactory>>evaluator for select list entry
     (beginners question) (Gerhard Obermann)


----------------------------------------------------------------------

Message: 1
Date: Fri, 15 Jun 2012 22:19:38 +0200
From: Gerhard Obermann <[hidden email]>
Subject: Re: [Seaside] How to use PTFactory>>evaluator for select list
       entry   (beginners question)
To: Seaside - general discussion <[hidden email]>
Message-ID:
       <CAOB-OiDchty+cYo1oPxst9koHFxqTa2DGQOQv7T3U=[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hi Sabine and welcome!

Try something like:

 script prototype element id: 'formB'; update: [:renderer | self
renderSecondListOn: renderer ].

renderSecondListOn: html
      html select
                       id: 'listBID';
                       list: #('1' '2' '3' '4' '5' '6');
                       selected: numb

Cheers
Gerhard





On Fri, Jun 15, 2012 at 12:45 PM, Sabine Knöfel <[hidden email]>wrote:

> Hello,
>
> I have 2 lists "ListA" and "ListB" and I want to follow "ListB" after
> "ListA".
> This means if I select a value in "listA", "listB" (which is in another
> Form) should update automatically.
>
> I have to use PTFactory>>evaluator, because I want to update more than one
> DOM elememts later.
>
> I succeed in *hiding* ListB after changing selection of ListA.
> But do not know what to send instead of "hide" for updating ListB with
> selection of ListA.
>
> The value to select should be stored in an instance variable "numb". This
> was working, when using "html scriptaculous updater" instead of "prototype
> evaluator". After changing the code to use evaluator, the callback does not
> work anymore.
>
> Cheers
> Sabine
> ###########
> renderListAOn: html
>     html
>         form: [
>             html select
>                 id: 'listAID';
>                 list: #('1' '2' '3' '4' '5' '6');
>                 selected: numb;
>                 callback: [ :value | self numb: value ];
>                 onChange:
>                         (html prototype evaluator
>                                 callback: [ :script |
>                                             script prototype element id:
> 'listBID'.    "hide"
>                                             numb inspect ];
>                                 return: false) ]
> ###########
> renderListBOn: html
>     html form
>         id: 'formB';
>         with: [
>                     html select
>                         id: 'listBID';
>                         list: #('1' '2' '3' '4' '5' '6');
>                         selected: numb ]
>
> _______________________________________________
 


_______________________________________________
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: How to use PTFactory>>evaluator for select list entry (beginners question)

Sabine Manaa
Hi Gerhard,

yeah, It works!!!
Thank you very much. You saved a lot of time for me!

Sabine