You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Darran White <Da...@opsera.com> on 2007/07/24 18:33:46 UTC

Clay: pass an id from a clay component to a javascript function

Hi,

I`m trying to use a javascript function triggered by a selection change
which needs the id of the selection box.

I`m using clay which mangles the id`s and names of elements so I can`t
just use an id in my page and pass it to the javascript function.

 

I know you can set a javascript function in the   clay-config.xml for a
selectOneMenu like the following:- 

 

<attributes>

<set name="onchange" value="updateSelection(id);"/>

</attributes>

 

But how do I pass in the id of the selectOneMenu to this function??

 

regards

 

Darran White
Senior Developer

Mobile:  +44 (0) 7795577076 
Skype:   darran.white    Email:  darran.white@opsera.com
<ma...@opsera.com> 
www.opsera.com <http://www.opsera.com> 

Opsera Limited | Unit 69 Suttons Business Park
Reading | Berkshire | RG6 1AZ | UK

This e-mail is confidential, intended only for the named recipient(s)
above and may contain information that is privileged and confidential.
If you receive this message in error, or are not the named recipient(s),
please notify the sender at the phone number above, do not copy this
message, do not disclose its contents to anyone, and delete this e-mail
message from your computer. Although Opsera routinely screens for
viruses, addressees should scan this e-mail and any attachments for
viruses. Opsera makes no representation or warranty as to the absence of
viruses in this e-mail or any attachments.

 


Re: Clay: pass an id from a clay component to a javascript function

Posted by Ryan Wynn <bi...@gmail.com>.
The way I like to do this is by passing a reference to this (the
current html element) to the javascript function

<set name="onchange" value="updateSelection(this);"/>

That will pass the <select> element and you can get its id from there.


On 7/24/07, Darran White <Da...@opsera.com> wrote:
> Hi,
>
> I`m trying to use a javascript function triggered by a selection change
> which needs the id of the selection box.
>
> I`m using clay which mangles the id`s and names of elements so I can`t
> just use an id in my page and pass it to the javascript function.
>
>
>
> I know you can set a javascript function in the   clay-config.xml for a
> selectOneMenu like the following:-
>
>
>
> <attributes>
>
> <set name="onchange" value="updateSelection(id);"/>
>
> </attributes>
>
>
>
> But how do I pass in the id of the selectOneMenu to this function??
>
>
>
> regards
>
>
>
> Darran White
> Senior Developer
>
> Mobile:  +44 (0) 7795577076
> Skype:   darran.white    Email:  darran.white@opsera.com
> <ma...@opsera.com>
> www.opsera.com <http://www.opsera.com>
>
> Opsera Limited | Unit 69 Suttons Business Park
> Reading | Berkshire | RG6 1AZ | UK
>
> This e-mail is confidential, intended only for the named recipient(s)
> above and may contain information that is privileged and confidential.
> If you receive this message in error, or are not the named recipient(s),
> please notify the sender at the phone number above, do not copy this
> message, do not disclose its contents to anyone, and delete this e-mail
> message from your computer. Although Opsera routinely screens for
> viruses, addressees should scan this e-mail and any attachments for
> viruses. Opsera makes no representation or warranty as to the absence of
> viruses in this e-mail or any attachments.
>
>
>
>