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
AnushaAnusha 

Re : onselect Event is not working for selectList

Hi,

I have a selectList, which displaying One,Two,three Values.

When i select "One", then some action has to perform. But onselect event is not working in SelectList.

 

I have written like this...

<apex:selectList id="sltOpn" value="{!PricingMethod}" onselect="alert('OnSelect Event');">

   <apex:selectoptions value="{!PricingMethodNames}"/>

 </apex:selectList>

 

when i select one of my option alert has to come, but its not coming..

 

Please help me..................!:smileysad:

 

regards

RB

 

LakshmanLakshman

Try using onChange event like this:

 

<apex:selectList id="sltOpn" value="{!PricingMethod}" onChange="javascript&colon;alert('I am changed to:'+this.value);">

   <apex:selectoptions value="{!PricingMethodNames}"/>

 </apex:selectList>



It should work.

 

Regards,

Lakshman

AnushaAnusha

HI Lakshman,

Ok but, when I'm selecting previous value then onChange is not Firing.

For Example, Picklist consist  of One,Two & Three.

If I select "two", then onChange will fire, again when I Select "two" at that time its not firing,

 

i.e..,  if I select same value again then its not Firing.

LakshmanLakshman

Let me know what you want to do on this event.

AnushaAnusha

I want to render some part of my Screen using picklist values

LakshmanLakshman

So are there othere dependent fields on the page which are part of filtering/rendering operation?

AnushaAnusha

Yes.............

LakshmanLakshman

The job of onselect function is to select (highlight) text in an input. You will have to use onchange event there is no potion could find.

You can rather make events on other dependent filters.

 

Regards,

Lakshman

LakshmanLakshman

I dint figure out that you are not giving size parameter in select list. Try the following code it will work:

 

<apex:selectList id="sltOpn" value="{!PricingMethod}"  onclick="alert('I am changed to:'+this.value);">
<apex:selectoptions value="{!PricingMethodNames}"/>
</apex:selectList>

 

Let me know if it works for you.

 

Regards,

Lakshman