1. 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

Discussion in 'Troubleshooting and Problems' started by Helmut2509, Dec 4, 2013.

  1. Helmut2509

    Helmut2509 Member

    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?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    How are you creating the select box?
     
  3. Helmut2509

    Helmut2509 Member

    <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>
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yeah, you can't attach an onchange using xen:select. You'll need to add a class and attach a JacaScript event.
     
  5. Helmut2509

    Helmut2509 Member

    already done.
    thanx anyway.
     

Share This Page