You need to sign in to do that
Don't have an account?
Disabling a field in input page based on a picklist value
Hi All,
VF page to hide one of two fields based on picklist value in the same page.plz verify my code is right or worng.im run this code nothing happen.
<apex:page standardController="Account">
<script type="text/javascript">
function changetextbox()
{
var ele=document.getElementById('{!$Component.form1.block1.populate}');
var opt=ele.options[ele.selectedIndex];
if (opt=='Prospect')
{
var newEle=document.getElementById('{!$Component.form1.block1.textpop}');
newEle.disabled=true;
}
}
</script>
<apex:form id="form1">
<apex:pageBlock id="block1">
<apex:inputField value="{!Account.Type}" id="populate" onchange="changetextbox();"/>
<apex:inputField value="{!Account.accountnumber}" id="textpop"/>
</apex:pageBlock>
</apex:form>
</apex:page>
You were close. You just need to change one line and it will work:
Add the .text to the end of that line like I did above, and it will work.
All Answers
You were close. You just need to change one line and it will work:
Add the .text to the end of that line like I did above, and it will work.
thanks for reply JohnSchultz its working fine but i have one more doubt in opportunity Stage field when i select "closed won". then all the fields closed won pageblocksection will be display in VF otherwise it will be disable.