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!

Null or not an object error?

Status
Not open for further replies.

GRFX69

IS-IT--Management
Feb 22, 2009
2
US
I am getting this error.

Line: 30
Char: 1
Error: 'options' is null or not an object
Code: 0

Here is my code.

In the Header I have the follow:
<script language="javascript">
function gotoMonth()
{
var theMonthList = document.forms[0].cboMonth;
var theYearList = document.forms[0].cboYear;
var theMonth = theMonthList.options[theMonthList.selectedIndex].value;
var theYear = theYearList.options[theYearList.selectedIndex].value;
theLocation = "index.cfm?fuseaction=ViewGoToMonth&GoToYear=" + theYear + "&GoToMonth=" + theMonth;
window.open(theLocation, "_top", "")
}

</script>

Here is the Form code that is located in the body.

<form>
<b><font size="2">Go To: &nbsp;</font></b>
<select name="cboMonth" onmouseover="self.status='Select Month';return true" onmouseout="self.status='';return true">
<cfset MonthNum = 0>
<cfloop index="MonthIndex" list="#Session.MonthList#">
<cfoutput>
<cfif #MonthIndex# EQ #DateMonthStr#>
<cfset MonthNum = #MonthNum# + 1>
<option value="#MonthNum#" selected>#MonthIndex#</option>
<cfelse>
<cfset MonthNum = #MonthNum# + 1>
<option value="#MonthNum#">#MonthIndex#</option>
</cfif>
</cfoutput>
</cfloop>
</select>
<select name="cboYear" onmouseover="self.status='Select Year';return true" onmouseout="self.status='';return true">
<cfloop index="YearIndex" from="#Year10Past#" to="#Year10Fut#" step="1">
<cfoutput>
<cfif #YearIndex# EQ #DateYear#>
<option value="#YearIndex#" selected>#YearIndex#</option>
<cfelse>
<option value="#YearIndex#">#YearIndex#</option>
</cfif>
</cfoutput>
</cfloop>
</select>
&nbsp;
<input type="button" value="&nbsp;Go&nbsp;" onClick="JavaScript:gotoMonth()" onMouseOver="self.status='Go';return true" onMouseOut="self.status='';return true">
</form>

And the URL where the Code is being used it here:


Problem is the with GO TO: Combo Boxes and the Go Button.

Thanks in advanced for any help!
GRFX69
 
It seems you have two forms and the gotoMonth button and the select-one elements are on the second forms (forms[[red]1[/red]). Hence the error.
 
Due to some typos etc, if the sentence is not clear, I mean this.
[tt] var theMonthList = document.forms[[red]1[/red]].cboMonth;
var theYearList = document.forms[[red]1[/red]].cboYear;
[/tt]
 
Extreme thanks to Dian and tsuji!

I did not try Dian's idea, but first tried tsuji and it worked perfectly!

I freaking love the internet and this forum!

PS. First time poster to any help forum! Usually just read them for the answers!

Thanks again!

GRFX69
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top