[Seaside] Re: Setting checkboxes using JQuery

Lukas Renggli renggli at gmail.com
Fri Dec 12 14:41:25 UTC 2008


Have a look at the JQuery documentation:

    http://docs.jquery.com/Attributes/val#val.28.C2.A0val_.29_2

I agree that the way the #value: thing works is a bit strange (you
have to assign IDs to the checkbox and specify those in the argument).
There is nothing we can do about that in Seaside though, report it in
the JQuery bug tracker if you think that this should be changed.

I suggest to use #attributeAt:put:. This works without problems and is
relatively simple:

   (html jQuery: ':checkbox') attributeAt: 'checkbox' put: true

Cheers,
Lukas

On Fri, Dec 12, 2008 at 3:15 PM, Jan van de Sandt <jvdsandt at gmail.com> wrote:
> Hello,
>
> I think I found the solution:
>
>     html div: [
>         html text: 'Select: '.
>         html anchor
>             onClick: ((html jQuery expression: ':checkbox:not(:checked)')
> trigger: 'click' );
>             with: 'All, '.
>         html anchor
>             onClick: ((html jQuery expression: ':checkbox:checked') trigger:
> 'click' );
>             with: 'None' ].
>
> This works perfectly :-)
>
> Jan.
>
>
> On Fri, Dec 12, 2008 at 2:53 PM, Jan van de Sandt <jvdsandt at gmail.com>
> wrote:
>>
>> Hello,
>>
>> I'm using Seaside 2.9, Squeak and the new Seaside JQuery support. I'm
>> creating a table where each row has a checkbox, just like GMail I want to
>> provide a "Select all" and a 'Select none" link.
>>
>> My idea is to use JQuery to select or unselect all checkboxes:
>>
>>     html anchor
>>         onClick: ((html jQuery expression: ':checkbox') value: 'checked');
>>         with: 'All, '.
>>
>> The problem is that this adds the value="check" attribute to all checkbox
>> elements but I need the checked="checked" attribute!
>>
>> I also tried:
>>
>>     html anchor
>>         onClick: ((html jQuery expression: ':checkbox') do: [ :each | each
>> click ]);
>>         with: 'All, '.
>>
>> But this doesn't work because the JQueryInstance object has no click
>> method.
>>
>> Can anyone help me out?
>>
>> Jan.
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list