You are on the right track.

jhb is the right way to add the button. An event first triggers the JS
handler which in turn calls a J handler if required. In your case you don't
require a J handler so all you need is the JS handler.

You should be able to add your JS handler and a jhb button and test your
changes.

Eventually ide/jhs will be opened up for svn updates and at that time you
could submit your changes directly. For now I am keeping ide/jhs a bit
closed, If you sent me your changes (either the entire script or just the
commented changes) I'd be happy to integrate them in a jal package.

On Mon, Mar 21, 2011 at 1:36 PM, Raul Miller <[email protected]> wrote:

> Whenever I have used jal in jhs, I have been missing the old "select
> all"/"select none" functionality.
>
> So, today, I looked at a jal page, to see how I could add this to the page.
>
> And, it looks to me as if I could add a function like:
>
> function ChangeCheckboxes(fn) {
>        var inps= document.getElementsByTagName('input');
>        var iLen= inps.length
>        for (var j= 0; j<iLen; j++) {
>                var inp= inps[j];
>                if ('checkbox' === inp.type) inp.checked= fn(inp.checked)
>        }
> }
>
> to the JS=: at the bottom of addons/ide/jhs/jal.ijs
>
> With this in place, I could use:
>
> <input type="button" onclick="ChangeCheckboxes(function(t){return
> !t;});" value="Toggle Selected" />
> <input type="button" onclick="ChangeCheckboxes(function(){return
> true;});" value="Select All" />
> <input type="button" onclick="ChangeCheckboxes(function(){return
> false;});" value="Select None" />
>
> to get the functionality I wish I had.
>
> But I am not sure how best to get them on the page.
>
> The other buttons were written by jhb, but that does not seem like the
> right choice for buttons that are not meant to raise a server event.
>
> What would be a stylistically good way of integrating this kind of
> change with jal?
>
> Thanks,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to