salesforce - How to get the previous selected value for select list in visaulforce page -
<apex:selectoption itemvalue="reports" itemlabel="select report" /> <apex:selectoption itemvalue="1" itemlabel="test1"/> <apex:selectoption itemvalue="2" itemlabel="test2"/> select value 1 first, how retrieve value of 1 after choose 2 in visualforce page
</apex:selectlist>
you can use onfocus attribute of selectlist component storing current value of picklist before choosing new 1 in js variable , onselect or onchange attributes of selectlist processing of new , old values.
<apex:selectlist value="{!test}" onfocus="storeoldvalue(this.value)"> <apex:selectoptions value="{!testoptions}"/> </apex:selectlist> <script type="text/javascript"> function storeoldvalue(oldvalue){ oldval = oldvalue; } </script>
Comments
Post a Comment