codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  error in jsp : `document.esiidForm.FMONTH` is null or not an object.  sona2007 at 03:21 on Thursday, September 27, 2007
 

I'm getting an error as below

'document.esiidForm.FMONTH' is null or not an object.

The complete jsp is

<%@page contentType="text/html"%>
<%@ page import="tems.pub.servlets.Esiid" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Iterator" %>

<jsp:useBean id="data" scope="request" class="tems.pub.servlets.Esiid" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>ESIID Transactions</title>
<LINK REL = 'stylesheet' type = 'text/css' href = '/esiidlookup/styles/ercot_portal.css'>
<style>
body#main {
font-family:verdana;
font-size:10px;
top-margin:0px;
margin-top:0px;
margin-right:0px;
margin-left:0px;
margin-bottom:0px;
background:#ffff url(/esiidlookup/images/body_gradient1.jpg) repeat-x;
}

td#main {
font-family:verdana;
font-size:10px;
top-margin:0px;
left-margin:0px;
background-color:#ffffff;
}
th#main {
font-family:verdana;
font-size:10px;
top-margin:0px;
left-margin:0px;
color:blue;
background-color:#ffffff;
}
input#main, select#main {
font-family:verdana;
font-size:10px;
height:18px;
}
.title {
font-family:verdana;
font-size:12px;
font-weight:bold;
}
.bar {
height:8px;
background: #ccffff url(/esiidlookup/images/bar_horizon.jpg) repeat-x;
</style>

<script language="JavaScript">
<!--
var lastDetail = null;

//Handles what transactions details are showing.
//Also hides the details section when transaction details are closed
//or a new transaction detail is opened.
function ShowTypeDetails(txt)
{
if (lastDetail != null)
{
if (lastDetail != txt)
document.getElementById(lastDetail).style.display = 'none';
}
//else
// alert('lastDetail = null');
var curStyle = document.getElementById(txt).style.display;
if ( curStyle == 'none' )
{
document.getElementById(txt).style.display = 'block';
document.getElementById('details').innerHTML = '';
lastDetail = txt;
}
else
{
document.getElementById(txt).style.display = 'none';
document.getElementById('details').innerHTML = '';
lastDetail = txt;
}
}

//Displays the appropriate details section. Called from a link
// embedded in a record of the transaction details.
function UpdatePage(txt)
{
document.getElementById('details').innerHTML = document.getElementById(txt).innerHTML;
}

//Calculates what values to populate and select
//On the date dropdown menues
function setDropDowns ()
{

//Stores the id names of the month dropdown options.
var monthNamesF = new Array(12)
monthNamesF[0] = "Fjanuary";
monthNamesF[1] = "Ffebruary";
monthNamesF[2] = "Fmarch";
monthNamesF[3] = "Fapril";
monthNamesF[4] = "Fmay";
monthNamesF[5] = "Fjune";
monthNamesF[6] = "Fjuly";
monthNamesF[7] = "Faugust";
monthNamesF[8] = "Fseptember";
monthNamesF[9] = "Foctober";
monthNamesF[10] = "Fnovember";
monthNamesF[11] = "Fdecember";

var monthNamesT = new Array(12)
monthNamesT[0] = "Tjanuary";
monthNamesT[1] = "Tfebruary";
monthNamesT[2] = "Tmarch";
monthNamesT[3] = "Tapril";
monthNamesT[4] = "Tmay";
monthNamesT[5] = "Tjune";
monthNamesT[6] = "Tjuly";
monthNamesT[7] = "Taugust";
monthNamesT[8] = "Tseptember";
monthNamesT[9] = "Toctober";
monthNamesT[10] = "Tnovember";
monthNamesT[11] = "Tdecember";


//Get the current month, previous month, and year
var date_now = new Date();
var month_now = date_now.getMonth();
var month_prev = month_now -1;
if (month_prev < 0)
month_prev = 11;
var year_now = date_now.getYear();

//Set the selected months
var curMonthOptionF = document.getElementById(monthNamesF[month_prev]);


document.esiidForm.FMONTH.options[month_prev].selected = true; //curMonthOptionF.selected = true;

var curMonthOptionT = document.getElementById(monthNamesT[month_now]);
document.esiidForm.TMONTH.options[month_now].selected = true;

//curMonthOptionT.selected = true;

//Set from year
var selected = 0;
document.esiidForm.FYEAR.options.length=0;
var j = 0;
for (var i=2001; i<=year_now; i++)
{
if (i == year_now-1)
{
selected = j;
}
document.esiidForm.FYEAR.options[j]=new Option(i, i, false, false);
j++;
}
document.esiidForm.FYEAR.options[selected].selected = true;


//Set to year
document.esiidForm.TYEAR.options.length=0;
j = 0;
for (var i=2001; i<=year_now; i++)
{
if (i == year_now)
{
selected = j;
}
document.esiidForm.TYEAR.options[j]=new Option(i, i, false, false);
j++;
}
document.esiidForm.TYEAR.options[selected].selected = true;
}


//--------------------------------------------------------------
// Then remaining javascript handles the sortable table in the transaction details section
addEvent(window, "load", sortables_init);

var SORT_COLUMN_INDEX;

function sortables_init() {
// Find all tables with class sortable and make them sortable
if (!document.getElementsByTagName) return;
tbls = document.getElementsByTagName("table");
for (ti=0;ti<tbls.length;ti++) {
thisTbl = tbls[ti];
if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
//initTable(thisTbl.id);
ts_makeSortable(thisTbl);
}
}
}

function ts_makeSortable(table) {
if (table.rows && table.rows.length > 0) {
var firstRow = table.rows[0];
}
if (!firstRow) return;

// We have a first row: assume it's the header, and make its contents clickable links
for (var i=0;i<firstRow.cells.length;i++) {
var cell = firstRow.cells;
var txt = ts_getInnerText(cell);
cell.innerHTML = '<a href="#" class="sortheader" '+
'onclick="ts_resortTable(this, '+i+');return false;">' +
txt+'<span class="sortarrow"> </span></a>';
}
}

function ts_getInnerText(el) {
if (typeof el == "string") return el;
if (typeof el == "undefined") { return el };
if (el.innerText) return el.innerText; //Not needed but it is faster
var str = "";

var cs = el.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
switch (cs.nodeType) {
case 1: //ELEMENT_NODE
str += ts_getInnerText(cs);
break;
case 3: //TEXT_NODE
str += cs.nodeValue;
break;
}
}
return str;
}

function ts_resortTable(lnk,clid) {
// get the span
var span;
for (var ci=0;ci<lnk.childNodes.length;ci++) {
if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
}
var spantext = ts_getInnerText(span);
var td = lnk.parentNode;
var column = clid || td.cellIndex;
var table = getParent(td,'TABLE');

// Work out a type for the column
if (table.rows.length <= 1) return;
var itm = ts_getInnerText(table.rows[1].cells[column]);
sortfn = ts_sort_caseinsensitive;
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^[$]/)) sortfn = ts_sort_currency;
if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
SORT_COLUMN_INDEX = column;
var firstRow = new Array();
var newRows = new Array();
for (i=0;i<table.rows[0].length;i++) { firstRow = table.rows[0]; }
for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; }

newRows.sort(sortfn);

if (span.getAttribute("sortdir") == 'down') {
ARROW = ' �ª';
newRows.reverse();
span.setAttribute('sortdir','up');
} else {
ARROW = ' �«';
span.setAttribute('sortdir','down');
}

// We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
// don't do sortbottom rows
for (i=0;i<newRows.length;i++) { if (!newRows.className || (newRows.className && (newRows.className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows);}
// do sortbottom rows only
for (i=0;i<newRows.length;i++) { if (newRows.className && (newRows.className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows);}

// Delete any other arrows there may be showing
var allspans = document.getElementsByTagName("span");
for (var ci=0;ci<allspans.length;ci++) {
if (allspans[ci].className == 'sortarrow') {
if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
allspans[ci].innerHTML = ' ';
}
}
}

span.innerHTML = ARROW;
}

function getParent(el, pTagName) {
if (el == null) return null;
else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase
return el;
else
return getParent(el.parentNode, pTagName);
}
function ts_sort_date(a,b) {
// y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
if (aa.length == 10) {
dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
} else {
yr = aa.substr(6,2);
if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
}
if (bb.length == 10) {
dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
} else {
yr = bb.substr(6,2);
if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
}
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
}

function ts_sort_currency(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
return parseFloat(aa) - parseFloat(bb);
}

function ts_sort_numeric(a,b) {
aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
if (isNaN(aa)) aa = 0;
bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
if (isNaN(bb)) bb = 0;
return aa-bb;
}

function ts_sort_caseinsensitive(a,b) {
test=null;
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}

function ts_sort_default(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}


function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+, NS6 and Mozilla
// By Scott Andrew
{
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}


-->
</script>

</head>
<basefont FACE="Arial","Helvetica","sans-serif">
<body id="main" onLoad="setDropDowns()">
<%
String showDHTMLOnly = request.getParameter("showDHTMLOnly");
if (showDHTMLOnly == null || !(showDHTMLOnly.equals("true")))
{
%>
<table cellpadding="0" cellspacing="0" align="center" width="100%;" >
<tr>
<td colspan="2" class="bar"></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" align="center" style="border-left:solid 2px #666666;border-top:solid 2px #666666;border-right:solid 2px #cccccc;border-bottom:solid 2px #cccccc;">
<tr>
<td valign="top" id="main">
<form name="esiidForm" action="EsiidServlet" method="post">
<div style="padding:10px;" align="left" class="title">Find Business Process Transactions for Single ID
<input type="hidden" name="esiidPage" value="transByEsiid"/>
<table>
<tr>
<td id="main"><b>Certificate </b></td>
<td id="main">
<select id="main" NAME="CERT" SIZE="1">
<option value="RETAIL" selected>RETAIL</option>
<option value="SOLUTIONS">SOLUTIONS</option>
<option value="RPOLR">RPOLR</option>
<option value="SPOLR">SPLOR</option>
</select>
</td>
</tr>
</table>
<table>
<tr>
<td id="main"><b>* Enter ESI ID # </b><input id="main" type="text" name="esiid" value="" align="left" size="30"/></td>
<td id="main"><b>* Enter Orig Trxn # </b><input id="main" type="text" name="TRXN" value="" align="left" size="30"/></td>
</tr>
<tr>
<td id="main">
<table>
<tr>
<td id="main">From</td>
<td id="main">
<select id="main" NAME="FMONTH" SIZE="1">
<option id="Fjanuay" value="0">Jan</option>
<option id="Ffebuary" value="1">Feb</option>
<option id="Fmarch" value="2">Mar</option>
<option id="Fapril" value="3">Apr</option>
<option id="Fmay" value="4">May</option>
<option id="Fjune" value="5">Jun</option>
<option id="Fjuly" value="6">Jul</option>
<option id="Faugust" value="7">Aug</option>
<option id="Fseptember" value="8">Sep</option>
<option id="Foctober" value="9">Oct</option>
<option id="Fnovember" value="10">Nov</option>
<option id="Fdecember" value="11">Dec</option>
</select>
<select NAME="FYEAR" SIZE="1">
</select>
</td>
<td id="main">Through</td>
<td id="main">
<select id="main" NAME="TMONTH" SIZE="1">
<option id="Tjanuay" value="0">Jan</option>
<option id="Tfebuary" value="1">Feb</option>
<option id="Tmarch" value="2">Mar</option>
<option id="Tapril" value="3">Apr</option>
<option id="Tmay" value="4">May</option>
<option id="Tjune" value="5">Jun</option>
<option id="Tjuly" value="6">Jul</option>
<option id="Taugust" value="7">Aug</option>
<option id="Tseptember" value="8">Sep</option>
<option id="Toctober" value="9">Oct</option>
<option id="Tnovember" value="10">Nov</option>
<option id="Tdecember" value="11">Dec</option>
</select>
<select NAME="TYEAR" SIZE="1">
</select>
</select>
</td>
</tr>
</table>
</td>
<tr>
<td id="main">
<input id="main" type="checkbox" name="OPEN" value="on">Show Open
<input id="main" type="checkbox" name="LATEST" value="on">Show Latest
</td>
</tr>
<tr>
<td id="main">* ESI ID # or Orig Trxn # is required.</td>
<td id="main"><input type="reset" value="Clear" allign"left"/>

<input type="submit" name="esiidRequest" value="Submit" allign"left"/>
</td>
</tr>
</table>
</div>
</form>
</td>
</tr>
</table>

<%
if ( data != null && data.getDHTML().length() > 0)
{
%>
<p>
<!-- This section is generated by esiidTrannsaction.xsl and passed into the jsp. -->
<%= data.getDHTML() %>
<!-- The details section is populated as needed with the appropriate D_HTML section. That data is generated by esiidTransaction.xsl -->
<span id="details">
</span>
</p>
<%
//Put all the D_HTML sections here so they do not interfere with the display of the rest of the page
Iterator itr = data.getDetails().iterator();
while( itr.hasNext() )
{
%>
<%= (String)itr.next() %>
<%
}
}
}
else //only want the details section not the request form
{
%>
<table cellpadding="0" cellspacing="0" align="center" width="100%;" >
<!-- This section is generated by esiidTrannsaction.xsl and passed into the jsp. -->
<%= data.getDHTML() %>
<!-- The details section is populated as needed with the appropriate D_HTML section. That data is generated by esiidTransaction.xsl -->
<span id="details">
</span>
</table>
<%
//Put all the D_HTML sections here so they do not interfere with the display of the rest of the page
Iterator itr = data.getDetails().iterator();
while( itr.hasNext() )
{
%>
<%= (String)itr.next() %>
<%
}
}
%>

</body>
</html>





//








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007