I have used <apex:selectList /> many times but recently I had a trouble with it; onchange event not firing only for some values.
Below are the selectOptions when I put them in a debug statement.
onchange action is firing for first and third values but nothing happens for second value. It's not hitting the action LoadProductDetails but surprisingly there are no any script errors in the console. Wasted a day and put an <apex:pageMessages /> component inside pnlProductInfo which gets rerender from my <apex:actionSupport/>.
Wooooh! here it's
But what's the validation that's failing here? It's some salesforce server side validation that checks for selectList options. If you noticed, in my second selectOption value, there is a DOUBLE SPACE between the words. Replaced it with a single space and working perfectly!
Cheers!
<apex:actionRegion id="salesItemActionRegion"> <apex:outputLabel value="Sales Item : "></apex:outputLabel> <apex:selectList id="drpSalesItem" value="{!selectedProduct}" size="1" > <apex:selectOptions id="optnSalesItem" value="{!ProductList}"></apex:selectOptions> <apex:actionSupport rerender="pnlProductInfo" action="{!LoadProductDetails}" event="onchange" /> </apex:selectList> </apex:actionRegion>
Below are the selectOptions when I put them in a debug statement.
System.SelectOption[value="value abc", label="value abc", disabled="false"], System.SelectOption[value="value def", label="value def", disabled="false"], System.SelectOption[value="value ghi", label="value ghi", disabled="false"]
onchange action is firing for first and third values but nothing happens for second value. It's not hitting the action LoadProductDetails but surprisingly there are no any script errors in the console. Wasted a day and put an <apex:pageMessages /> component inside pnlProductInfo which gets rerender from my <apex:actionSupport/>.
Wooooh! here it's
But what's the validation that's failing here? It's some salesforce server side validation that checks for selectList options. If you noticed, in my second selectOption value, there is a DOUBLE SPACE between the words. Replaced it with a single space and working perfectly!
Cheers!