Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enabling/Disabling Controls

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
0
0
US
I keep getting this error, can anyone help me out.

Code:
Error: 
Line: 638
'document.getElementById[...]' is null or not an object.

Which corresponds to this line from 'view source':
for (one in relation) for (two in relation[one]) document.getElementById(relation[one][two]).disabled=what.id!=one

Here is my entire page code:
Code:
<cfparam name="attributes.sec_mgr" default="">
<cfparam name="attributes.rpttype" default="">
<cfparam name="attributes.pay_date" default="">
<cfparam name="attributes.PayCycle" default="">
<cfparam name="attributes.ppebegin" default="">
<cfparam name="attributes.ppeend" default="">

<cfoutput>
<table cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td colspan="3"><form action="#application.self#?fuseaction=#xfa.submit#&TYPE=#trim(attributes.TYPE)#&report=#trim(attributes.REPORT)#" method="POST" name="REPORT"></td>
	</tr>
	<tr>
		<td class="formTitle" width="100" align="right">Department:</td>
		<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
		<td valign="top" class="rowText" width="100">#session.DEPT_NAME#</td>	
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
		<tr>
			<td class="formTitle" align="right">Section Manager:</td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				<SELECT name="sec_mgr">
					<cfloop query="getSECTIONMANAGER">
						<option value="#getSECTIONMANAGER.EMPLOYEE_ID#" <cfif getSECTIONMANAGER.EMPLOYEE_ID EQ attributes.sec_mgr> SELECTED</cfif>>#getSECTIONMANAGER.FULLNAME#</option>
					</cfloop>
				</SELECT>	
			</td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td class="formTitle" align="right">
			</td>		
		</tr>	
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>			
		<tr>
			<td class="formTitle" align="right">Select By:</td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				
			<input type="radio" name="rpttype" id="type_pd" value="PD" onClick="enableField(this)" rel="paydate">
				<label for="type_pd">Pay Date</label><br>
				
			<input type="radio" name="rpttype" id="type_pc" value="PC" onClick="enableField(this)" rel="paycycle">
				<label for="type_pc">Pay Cycle</label><br>
				
			<input type="radio" name="rpttype" id="type_dr" value="PR" onClick="enableField(this)" rel="daterange" >
				<label for="type_dr">Date Range</label><br>				

			</td>	
		</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	
		<TR>
			<td class="formTitle" align="right"><label for="pay_date"><span class="accessibility"></span>Pay Date:</label></td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				<select name="pay_date" id="pay_date" disabled="disabled">
					<cfloop query="getDates">
						<option value="#DateFormat(getDates.PAYDATE)#" <cfif DateFormat(getDates.PAYDATE) EQ attributes.pay_date> SELECTED</cfif>>#DateFormat(getDates.PAYDATE)#</cfloop>
				</SELECT>
			</td>
		</TR>				
		
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>						
		<tr>
			<td class="formTitle" align="right"><label for="type_pc"><span class="accessibility"></span>Pay Cycle:</label></td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				<select name="PayCycle" id="type_pc2" disabled="disabled">
					<cfloop query="getDates">
						<option value="#getDates.PERIOD#" <cfif getDates.PERIOD EQ attributes.PayCycle> SELECTED</cfif>>#getDates.PERIOD#</cfloop>
				</SELECT>
			</td>	
		</tr>
			
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
							
		<tr>
			<td class="formTitle" align="right"><label for="type_dr"><span class="accessibility"></span>PPE Begin:</label></td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				<SELECT name="PPEBEGIN" id="type_dr2" disabled="disabled">
					<cfloop query="getDates">
						<option value="#getDates.PPE_BEGIN#" <cfif getDates.PPE_BEGIN EQ attributes.PPEBEGIN> SELECTED</cfif>>#DateFormat(getDates.PPE_BEGIN)#</cfloop>
				</SELECT>
			</td>
			<td class="formTitle" align="right"><label for="type_dr"><span class="accessibility"></span>PPE End:</label></td>
			<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
			<td valign="top" class="rowText">
				<SELECT name="PPEEND" id="type_dr2e" disabled="disabled">
					<cfloop query="getDates">
						<option value="#getDates.PPE#" <cfif getDates.PPE EQ attributes.PPEEND> SELECTED</cfif>>#DateFormat(getDates.PPE)#</cfloop>
				</SELECT>
			</td>					
		</tr>
				
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" bgcolor="#application.borderColor#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3" height="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
	</tr>
	<tr>
		<td colspan="3">
			<table cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td>
						<table width="50" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td height="20" align="center" onClick="javascript:history.go(-1);" title="Back A Page" class="formButton" onMouseOver="this.className='formButtonHover';" onMouseOut="this.className='formButton';" onmousedown="this.className='formButtonClick';" onmouseup="this.className='formButton';">Back</td>
							</tr>
						</table>
					</td>
					<td width="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
					<td>
						<table width="50" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td height="20" align="center" onClick="javascript:document.REPORT.reset();" title="Reset Form" class="formButton" onMouseOver="this.className='formButtonHover';" onMouseOut="this.className='formButton';" onmousedown="this.className='formButtonClick';" onmouseup="this.className='formButton';">Reset</td>
							</tr>
						</table>
					</td>
					<td width="5"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
					<td>
						<table width="50" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td height="20" align="center" onClick="javascript:document.REPORT.submit();" title="Submit criteria for report processing" class="formButton" onMouseOver="this.className='formButtonHover';" onMouseOut="this.className='formButton';" onmousedown="this.className='formButtonClick';" onmouseup="this.className='formButton';">Submit</td>
							</tr>
						</table>
					</td>	
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="3"></form></td>
	</tr>
</table>
</cfoutput>

<script type="text/javascript">

function enableField(what)
{
  var relation={
    'type_pd':['pay_date'],
    'type_pc':['type_pc2'],
    'type_dr':['type_dr2','type_dr2e']
  }

for (one in relation) for (two in relation[one]) document.getElementById(relation[one][two]).disabled=what.id!=one
}

</script>

Thanks,
Sherry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top