what's wrong with a simple (regular, no-need-for-external-libraries)
"onChange" like:
<select id="getmethisselectindex" name="getmethisselectindex"
onChange="myJsFunc();">
and in myJsFunc: var myid = $F('getmethisselectindex');
or did i miss something?
On Fri, Jan 30, 2009 at 11:59 AM, david <[email protected]> wrote:
>
> Hi Anjanesh,
>
> I use a simple bypass to this limitation:
> when observing an event, if it's a native event, I create a custom
> event "native:click" that reference the same call back to the original
> click observer.
> So firing this "native:click" event, does the job.
>
> --
> david
>
> On 29 jan, 16:35, Peter De Berdt <[email protected]> wrote:
>> On 29 Jan 2009, at 16:18, Anjanesh wrote:
>>
>> > I need to trigger a 'change' event for a 'select' element.
>>
>> > alert($($(elem).parentNode)); // shows [Object HTMLSelectElement]
>> > $($(elem).parentNode).fire('change'); // How do I indicate which
>> > option value to change to ?
>>
>> > But the fire() doesnt work. But no JS errors either.
>>
>> Fromhttp://prototypejs.org/api/element/fire:
>> Element#fire does not support firing native events. All custom event
>> names must be namespaced (using a colon). This is to avoid custom
>> event names conflicting with non-standard native DOM events such as
>> mousewheel and DOMMouseScroll.
>>
>> What you want to to, is set the selectedIndex value from the <select>
>> element as is documented
>> athttp://www.w3schools.com/htmldom/dom_obj_select.asp
>> selectedIndex needs to be an integer. If you want to select it by
>> value, then you'll need to loop the values and when you find the right
>> one, check what index it has (selectedIndex is a getter and a setter)
>> and set it to that index.
>>
>> Best regards
>>
>> Peter De Berdt
> >
>
--
Lars Schwarz
Heiligengeiststr. 26
26121 Oldenburg
T 0441 36110338
M 0151 1727 8127
W www.bitrocker.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---