Type is a picklist and reports is a checkbox. When a certain picklist is selected I want the checkbox to be disabled. I tried using an if statement but it does not work and I'm not sure why. Can anyone help? Thanks.
VisualForce page
<apex:page standardController="Account" extensions="getItems">
<apex:outputPanel layout="block" style="overflow:auto;width:500;height:180px">
<apex:form styleClass="formId">
<apex:pageblock id="table">
<script>
function openWindowPopup(bid,rid){
var typeVal = document.getElementById(bid).value;
var Reports = document.getElementById(rid).checked;
if(typeVal = "type1"){
Reports.disabled = true;
}
else{
Reports.disabled = false;
}
window.open('https://www.local.com?type='+typeVal+'&rprts='+Reports);
}
</script>
<apex:pageblocktable id="pageBlockId" value="{!Assetitems}" var="lines" >
<apex:column >
<apex:commandbutton value="Generate" reRender="table" onclick="openWindowPopup('{!$Component.mybid}''{!$Component.myrid}')" />
</apex:column>
<apex:column headerValue="Type">
<apex:inputField value="{!Asset.Type__c}" id="mybid"/>
</apex:column>
<apex:column headerValue="Reports">
<apex:inputField value="{!Asset.Reports__c}" id="myrid"/>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:outputPanel>