triggerFormElement: and checkboxes?

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

triggerFormElement: and checkboxes?

Mart-Mari Breedt
Hi,

I wondering, has anyone else also experienced that triggerFormElement:
doesn't work with checkboxes?

If you change "SUFormTest>>renderCheckBoxOn: html" to:

renderCheckBoxOn: html
        self
                renderLabel: 'Check-Box'
                control: [ :fid :mid |
                        html checkbox
                                id: 'tempCB';
                                value: checkBox;
                                callback: [ :value | checkBox := value
];
                                onClick: (html updater
                                        id: mid;
                                        triggerFormElement: 'tempCB';
                                        callback: [ :r | r render:
checkBox ]) ]
                model: checkBox
                on: html

it doesn't work. While a similar kind of change to
"SUFormTest>>renderSelectListOn: html" to:

renderSelectListOn: html
        self
                renderLabel: 'Select-List'
                control: [ :fid :mid |
                        html select
                                id: 'tempSelect';
                                list: (1 to: 9);
                                selected: selectList;
                                callback: [ :value | selectList := value
];
                                onChange: (html updater
                                        id: mid;
                                        triggerFormElement:
'tempSelect';
                                        callback: [ :r | r render:
selectList ]) ]
                model: selectList
                on: html

does work.

Am I doing something wrong?

Thanks,

Mart-Mari

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

Re: triggerFormElement: and checkboxes?

Lukas Renggli
> I wondering, has anyone else also experienced that triggerFormElement:
> doesn't work with checkboxes?

The method comment in #triggerFormElement: gives you the answer. A
more detailled explanation can be found in the archive of this
mailing-list.

       "Serializing form elements does not always work as one would
expect, since Seaside sometimes depends on extra hidden-fields to be
triggered to be able to perform your callback-block. When encountering
a problem (check-boxes, multi-select lists) try using #triggerForm:
instead."

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: triggerFormElement: and checkboxes?

Mart-Mari Breedt
In reply to this post by Mart-Mari Breedt
Ah, ok. I read right over the exclusion list the first time around. I
was wondering when this magic salt of triggerFormElement: was gonna run
out :-(.

Last week you said that the best approach to solving my problem with
submit buttons and updaters is to add a slightly different method to
FormElement that only serializes the input elements and that is
internally used by
#triggerForm. I really do not know how to do this. Will please just give
a couple of pointers?

Thanks for all the help!

Kind regards,

Mart-Mari


-----Original Message-----
From: Lukas Renggli [mailto:[hidden email]]
Sent: 23 Augustus 2006 11:18
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: Re: [Seaside] triggerFormElement: and checkboxes?

> I wondering, has anyone else also experienced that triggerFormElement:
> doesn't work with checkboxes?

The method comment in #triggerFormElement: gives you the answer. A
more detailled explanation can be found in the archive of this
mailing-list.

       "Serializing form elements does not always work as one would
expect, since Seaside sometimes depends on extra hidden-fields to be
triggered to be able to perform your callback-block. When encountering
a problem (check-boxes, multi-select lists) try using #triggerForm:
instead."

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: RE: triggerFormElement: and checkboxes?

Lukas Renggli
> Last week you said that the best approach to solving my problem with
> submit buttons and updaters is to add a slightly different method to
> FormElement that only serializes the input elements and that is
> internally used by
> #triggerForm. I really do not know how to do this. Will please just give
> a couple of pointers?

Ok, try adding the following patch to SULibrary. I haven't tested it,
but it should work. Maybe you can confirm that?

SULibrary>>ySubmitButtonPatch
        ^ 'Form.Element.Serializers.input = function(element) {
    switch (element.type.toLowerCase()) {
      case ''submit'':
        return false; /* ignore submit buttons */
      case ''hidden'':
      case ''password'':
      case ''text'':
        return Form.Element.Serializers.textarea(element);
      case ''checkbox'':
      case ''radio'':
        return Form.Element.Serializers.inputSelector(element);
    }
    return false;
  }'

> Thanks for all the help!

Thanks for your posts!

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: RE: triggerFormElement: and checkboxes?

Mart-Mari Breedt
In reply to this post by Mart-Mari Breedt
Hi,

Thank you. The provided patch does work. It fixes the example I posted
to you last week (The one with UpdaterTest1 and UpdaterTest2). When I
use it with check-boxes it works fine on the first go, but returns the
entire page contents in a second click of the checkbox, but this
probadly my own fault. I first tried this in a rather complex example,
and this is where I encountered the problem. I then tried to reproduce
this in a simpler example, but with no luck yet. So it is maybe just
something in my complex example that I am doing wrong, but I will look
at this a bit more and will let know as soon I figured this problem out.
(If I figure it out)

Kind regards,

Mart-Mari

-----Original Message-----
From: Lukas Renggli [mailto:[hidden email]]
Sent: 23 Augustus 2006 11:53
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: Re: RE: [Seaside] triggerFormElement: and checkboxes?

> Last week you said that the best approach to solving my problem with
> submit buttons and updaters is to add a slightly different method to
> FormElement that only serializes the input elements and that is
> internally used by
> #triggerForm. I really do not know how to do this. Will please just
give
> a couple of pointers?

Ok, try adding the following patch to SULibrary. I haven't tested it,
but it should work. Maybe you can confirm that?

SULibrary>>ySubmitButtonPatch
        ^ 'Form.Element.Serializers.input = function(element) {
    switch (element.type.toLowerCase()) {
      case ''submit'':
        return false; /* ignore submit buttons */
      case ''hidden'':
      case ''password'':
      case ''text'':
        return Form.Element.Serializers.textarea(element);
      case ''checkbox'':
      case ''radio'':
        return Form.Element.Serializers.inputSelector(element);
    }
    return false;
  }'

> Thanks for all the help!

Thanks for your posts!

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: RE: triggerFormElement: and checkboxes?

Mart-Mari Breedt
In reply to this post by Mart-Mari Breedt
Ah, I spoke too soon. I was able to reproduce the second click problem!
Please find an example attached.

Thanks,

Mart-Mari

-----Original Message-----
From: Mart-Mari Breedt
Sent: 23 Augustus 2006 12:33 nm
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: RE: RE: [Seaside] triggerFormElement: and checkboxes?

Hi,

Thank you. The provided patch does work. It fixes the example I posted
to you last week (The one with UpdaterTest1 and UpdaterTest2). When I
use it with check-boxes it works fine on the first go, but returns the
entire page contents in a second click of the checkbox, but this
probadly my own fault. I first tried this in a rather complex example,
and this is where I encountered the problem. I then tried to reproduce
this in a simpler example, but with no luck yet. So it is maybe just
something in my complex example that I am doing wrong, but I will look
at this a bit more and will let know as soon I figured this problem out.
(If I figure it out)

Kind regards,

Mart-Mari

-----Original Message-----
From: Lukas Renggli [mailto:[hidden email]]
Sent: 23 Augustus 2006 11:53
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: Re: RE: [Seaside] triggerFormElement: and checkboxes?

> Last week you said that the best approach to solving my problem with
> submit buttons and updaters is to add a slightly different method to
> FormElement that only serializes the input elements and that is
> internally used by
> #triggerForm. I really do not know how to do this. Will please just
give
> a couple of pointers?

Ok, try adding the following patch to SULibrary. I haven't tested it,
but it should work. Maybe you can confirm that?

SULibrary>>ySubmitButtonPatch
        ^ 'Form.Element.Serializers.input = function(element) {
    switch (element.type.toLowerCase()) {
      case ''submit'':
        return false; /* ignore submit buttons */
      case ''hidden'':
      case ''password'':
      case ''text'':
        return Form.Element.Serializers.textarea(element);
      case ''checkbox'':
      case ''radio'':
        return Form.Element.Serializers.inputSelector(element);
    }
    return false;
  }'

> Thanks for all the help!

Thanks for your posts!

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

CheckBoxTest.st (2K) Download Attachment