• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1119
  • Last Modified:

Unable to enable a select from an onclick JavaScript from another select

When I click on the "SR" select, I want the StatusList select to become enabled and no longer grayed out.  The code below is not doing this though it should I believe.  The select it the Struts html:select.  Anyone have any idea why it is not working?
Thanks!
function selectItemHandler() {
	var slist = document.getElementById('statusList');
	slist.disabled='false';
}
 
<html:select  property="reportType" title="Select Criteria" styleId="sr" onclick="selectCriteriaHandler();">
		  <html:option value="00">Choose</html:option>
		  <html:option value="PT">Vending Totals Report</html:option>
		  <html:option value="CT">Collection Totals Report</html:option>
		  <html:option value="CR">Roving Results Report</html:option>
</html:select>
 
<html:select styleId="statusList" property="status" title="Select Criteria" styleId="ss" disabled="true">
		  <html:option value="ALL">All Status Codes</html:option>
		  <html:option value="--">Pending</html:option>
		  <html:option value="4">Under Investigation</html:option>
		  <html:option value="1">No Problem</html:option>
		  <html:option value="2">Security Violation</html:option>
		  <html:option value="3Y">Vend Referral</html:option>
		  <html:option value="3N">Collection Referral</html:option>
		  <html:option value="3P">Theft Prevention Referral</html:option>
</html:select>

Open in new window

0
jwright9
Asked:
jwright9
1 Solution
 
Michel PlungjanIT ExpertCommented:
slist.disabled='false';

sets the disabled value to a string
This string evaluates as TRUE since false is
0, null, empty string or false

so remove the quotes

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now