#108 UNTESTED Patch to Allow JS Additions to createSelect()

open
nobody
5
2005-06-28
2005-06-28
Clifton Wood
No

Blame tf23 -- :)

<tf23> is it possible to sandwhich in an 'onchange()'
into a createSelect call?
<tf23> i'm looking at createSelect's code, I don't see
anyway to do it
<jamie> hm, that'd be interesting. I don't know where
that goes -- in each option, or just in the input tag?
<tf23> it'd be like <select onchange="doblah">
[Cliff_md] tf23: You could do it, but you'd need to
make a change to the core code.
<jamie> shouldn't be too hard
[Cliff_md] Nah, not at all.

=====

Now, to use the new bits, you have to use the more
sensible way to pass parameters to createSelect(). Say
I want to add an 'onclick=method()' to my <SELECT> tag.

createSelect('mylabel', $hashref, {
Return =>1,
Multiple => 0,
NSort => 1,
Select_Extra => 'onclick="method()"' }
);

If I want to add 'onmousedown="madness()"' to each
<OPTION> tag...

createSelect('mylabel', $hashref, {
Return =>1,
Multiple => 0,
NSort => 1,
Select_Extra => 'onclick="method()"',
Option_Extra => 'onmousedown="madness()"' }
);

If I want to disable only the "GreyMeOut" option...

createSelect('mylabel', $hashref, {
Return =>1,
Multiple => 0,
NSort => 1,
Select_Extra => 'onclick="method()"',
Option_Extra => 'onmousedown="madness()"',
OptionItem_Extra => { GreyMeOut => 'disabled' }
});

... that's the way it's SUPPOSED to work. If it
doesn't, let me know. I haunt the slashcode-developer's
mailing list or you can just hit me direct at
clifton.wood@gmail.com

Discussion

  • Clifton Wood
    Clifton Wood
    2005-06-28

    UNTESTED createSelect() patch...

     
    Attachments