function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
parkerAPTparkerAPT 

Javascript events (onclick, onmouseover, etc) broken for SelectOption [bug]

I am having trouble adding javascript events to the individual selectOptions.  I am able to add events to the wrapping selectList and selectCheckboxes.

 

Please see the following code example.  The expected behavior when clicking on a selectOption would be:

  1. An alert from the surrounding selectList or selectCheckboxes
  2. An alert from clicking on each individual selectOptio, like "Click me 1"
The rendered behavior only alerts when clicking on the selectList and not the underlying selectOptions.
 

I've inspected the HTML source and have confirmed that the onclick events do not get rendered.  Has there been a bug filed against this?

 

 

 

<apex:form >
<apex:selectCheckboxes id="selectedCheckboxesId"  layout="pageDirection" onclick="alert('clicked apex:selectCheckboxes')">
       <apex:selectOption id="so00" itemValue="Click me 1" itemLabel="Click me 1" onclick="alert('Click me 1')" onmouseover="alert('Moused Over 1')"/>
       <apex:selectOption id="so11" itemValue="Click me 2" itemLabel="Click me 2" onclick="alert('Click me 2')"/>
</apex:selectCheckboxes>
<apex:selectList id="selectedListId" onclick="alert('clicked selectList')">
       <apex:selectOption id="so0" itemValue="Click me 1" itemLabel="Click me 1" onclick="alert('Click me 1')" onmouseover="alert('Moused Over 1')"/>
       <apex:selectOption id="so1" itemValue="Click me 2" itemLabel="Click me 2" onclick="alert('Click me 2')"/>
</apex:selectList>
</apex:form>

 

 

Message Edited by parkerAPT on 02-24-2009 02:14 PM
sneezysneezy
same problem for me. Cannot get javascript functions to fire on Selectoption, onclick etc...
eliotstock2eliotstock2
I have the same problem. Will someone from Salesforce please respond and acknowledge if this is a bug.
tdoan+dev2tdoan+dev2

I am still having this problem.  Has anyone found a solution or work around to this problem?

RadnipRadnip

I'm getting this issue as well anyone else found a solution?