0

<apex:selectOption itemvalue="Reports" itemLabel="select Report" /> <apex:selectOption itemvalue="1" itemLabel="Test1"/> <apex:selectOption itemvalue="2" itemLabel="Test2"/>
</apex:selectList>
I select the value 1 first, how do I retrieve the value of 1 after I choose 2 in visualforce page

1
  • Can any have idea about it
    – saru
    Jul 21, 2016 at 17:02

1 Answer 1

1

You can use onfocus attribute of selectList component for storing current value of picklist before choosing the new one in some JS variable and onselect or onchange attributes of selectList for processing of new and 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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.