1

I wanted to populate an inputfield in VF page via Jquery based on a picklist value. Any inputs on how to achieve this....just missing out of syntax i believe...

<apex:inputfield value="{!Opportunity.StageName}" id="stagename" onChange="setProb()" ></apex:inputfield>
<apex:inputfield value="{!Opportunity.probability}" id="oprprob"/>

my script code is:

<apex:includescript value="{!URLFOR($Resource.jquery, 'js/jquery-1.11.3.js')}" />
<script>
function setProb(){ 
 //oprstage();
 jQuery( oprprob ).val = 10;
}
</script>

Can i refer the value picked from the list and based on it set the values for the other input field?

1 Answer 1

4

Your selector is not correct. You can use this to select the "ID Ends With"

function setProb(){ 
 jQuery( "[id$=oprprob]" ).val(10);
}
3
  • tried it but couldn't see it working Oct 23, 2015 at 0:14
  • See updated answer. Confirmed working
    – Eric
    Oct 23, 2015 at 0:17
  • thk u vry much eric Oct 23, 2015 at 0:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .