You need to sign in to do that
Don't have an account?
Maria Alexandra Andrica
hide picklist value
Hi ,
I want not to display in the Visualforce all the picklist values available and tried to hide them using below code but it is not working. Can you please help?
<apex:inputField required="true" value="{!pageCtrl.newCont.Status__c}" id="st" />
<script type="text/javascript">
(function(){
var inputStatus=document.querySelectorAll('[id$="st"]');
for (var i=0; i<inputStatus.length; i++){
if (inputStatus.options[i].value == 'Unqualified' )
inputStatus.remove(i);
}
}
</script>
I want not to display in the Visualforce all the picklist values available and tried to hide them using below code but it is not working. Can you please help?
<apex:inputField required="true" value="{!pageCtrl.newCont.Status__c}" id="st" />
<script type="text/javascript">
(function(){
var inputStatus=document.querySelectorAll('[id$="st"]');
for (var i=0; i<inputStatus.length; i++){
if (inputStatus.options[i].value == 'Unqualified' )
inputStatus.remove(i);
}
}
</script>
Try below code
thank you for the help, but it is stll not working. Am I missing something?
var select=document.getElementById('pg:frm:st'); th
<apex:component allowDML="true">
<apex:attribute name="pageCtrl" type="ExtManageMinutes" description="the root page controller reference" />
<apex:attribute name="rerenderList" type="String" description="To rerender the chatter" />
<script>
window.onload = function() {
hidePicklist();
};
function hidePicklist(){
var select=document.getElementById('{!$Component.contDetailSection.block1.block2.st}');
for (i=0;i<select.length; i++) {
if (select.options[i].value=='Unqualified') {
select.remove(i);
}
}
}
<script>
<apex:form id="contDetailSection">
<input type="hidden" id="savePopUpError" value="{!pageCtrl.pageConf.isPopUpError}"/>
<apex:actionFunction name="saveCont" action="{!pageCtrl.saveNewContact}" rerender="contactListId,contDetailSection" oncomplete="attendees.init();attendees.hideContDetail();openLinkType();deleteEmptyTd();" />
<apex:pageBlock title="New Contact" id="block1">
<apex:pageMessages id="pageMsg"/>
<input type="button" class="btn" value="Save" onclick="attendees.saveContact();"/>
<input type="button" class="btn" value="Cancel" onclick="attendees.closeNewContact();"/>
<apex:pageBlockSection showHeader="false" columns="1" id="block2">
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</div>
</apex:component>