You need to sign in to do that
Don't have an account?

Javascript Target an ID in Visualforce?
I've got my setSSKU() function setup to fire on the Model field, but I can't get my code to set the values on the Model and SKU(
<apex:inputField id="SSKU" value="{!objCase.Sensor_SKU__c}"/>
) fields. This code workw the the <apex:form> tag not sure why it's not working on this page.
JS
Visualforce
<apex:inputField id="SSKU" value="{!objCase.Sensor_SKU__c}"/>
) fields. This code workw the the <apex:form> tag not sure why it's not working on this page.
JS
function setSSKU(){ var SSKUE = document.getElementById('{!$Component.pbMainLumidigm:SSKU}'); var model = document.getElementById('{!$Component.pbMainLumidigm:LuModel}').value; if(model=='M-Series'){ for(i=0; i < SSKUE.options.length; i++){ if(SSKUE.options[i].text.indexOf('V') >= 0){ SSKUE.options[i].style.display = 'none'; } if(SSKUE.options[i].text.indexOf('M') >= 0){ if(SSKUE.options[i].style.display == 'none'){ SSKUE.options[i].style.display ='block'; } } } } if(model=='V-Series'){ for(i=0; i < SSKUE.options.length; i++){ if(SSKUE.options[i].text.indexOf('M') >= 0){ SSKUE.options[i].style.display = 'none'; } if(SSKUE.options[i].text.indexOf('V')>=0){ if(SSKUE.options[i].style.display =='none'){ SSKUE.options[i].style.display = 'block'; } } } } }
Visualforce
<apex:pageBlock id="pbMainLumidigm" title="Case Edit" rendered="{!IsLumidigmRecType}"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!saveCase}" onclick="return validateChannelPartner();"/> <apex:commandButton value="Save & Close" action="{!saveAndCloseCase}" onclick="return validateChannelPartner();"/> <apex:commandButton value="Cancel" immediate="true" action="{!cancelCase}"/> </apex:pageBlockButtons> <apex:pageBlockSection id="pbsFirst" title="Case Information" > <apex:pageBlockSectionItem > <apex:outputLabel value="Parent Case"></apex:outputLabel> <apex:inputField value="{!objCase.ParentId}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlockSection> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Product"/> <apex:inputField required="true" value="{!objCase.Product__c}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Model"></apex:outputLabel> <apex:inputField id="LuModel" required="true" value="{!objCase.Model__c}" onchange="setSSKU()"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> <apex:pageBlockSectionItem rendered="{!isRCNHRecType || ispivCLASS}"> <apex:outputLabel value="OS Language"/> <apex:inputField value="{!objCase.OS_Language__c}"/> </apex:pageBlock>
All Answers