• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 onChange event for selectbox

#1
in a template I have a selectbox which shall be dynamically populated when another selectbox changes its value.
so I defined an 'onChange' event in the selectbox tag:
onChange="javascript:toggleChannel(this.value);"

unfortuately, this does not appear in the sourcecode. Did I make a mistake or is this intentionally suppressed?
 
#3
How are you creating the select box?
<xen:select name="channels" value="" title="Channel" inputclass="Tooltip" id="ctrl_channels" onChange="javascript:toggleChannel(this.value);"></td>
xen:foreach loop="$channels" key="$index" value="$channel">
<xen:eek:ption value="{$channel.id}" label="{$channel.name}" />
</xen:foreach>
</xen:select>
 

Jeremy

Well-known member
#4
Yeah, you can't attach an onchange using xen:select. You'll need to add a class and attach a JacaScript event.