× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have several scripts generated by a RPG CGI program.  Script 1 and script 2 
below were generated in the same program loop.

The problem is that Script 1 throws an error:
"document.updTerms1.BEGDATE is either null or not an object".  This occurs 
regardless of what is in the field, so the browser must not be recognizing it 
as an object.  Script 2, which is identical for all practical purposes, works 
perfectly.  I've been over it and over it and I cannot figure out why one would 
work and not the other.

Here are the scripts and the accompanying forms

SCRIPT 1:
<script language="JavaScript">
<!--
function check1() {
if (document.updTerms1.BEGDATE.value == "" ) {
alert("Beginning Date cannot be blank.");
return false ;
}
else if (document.updTerms1.ENDDATE.value == "" ) {
alert("Ending Date cannot be blank.");
return false ;
}
else if (document.updTerms1.AMOUNT.value == "" ) {
alert("Amount cannot be blank.");
return false ;
}
else {
document.updTerms1.submit();
}
}
//-->
</script>

<form name="updTerms1" method="post" action="/members/SUPUPDTERM">
<input type="text" name="BEGDATE" value="11/1/2002" />
<input type="text" name="ENDDATE" value="10/30/2003" />
<input type="text" name="AMOUNT" value="65.00" />
<input type="button" value="Update" 
onClick="check1()" />
</form>


SCRIPT 2:

<script language="JavaScript">
<!--
function check2() {
if (document.updTerms2.BEGDATE.value == "" ) {
alert("Beginning Date cannot be blank.");
return false ;
}
else if (document.updTerms2.ENDDATE.value == "" ) {
alert("Ending Date cannot be blank.");
return false ;
}
else if (document.updTerms2.AMOUNT.value == "" ) {
alert("Amount cannot be blank.");
return false ;
}
else {
document.updTerms2.submit();
}
}
//-->
</script>

<form name="updTerms2" method="post" action="/members/SUPUPDTERM">
<input type="text" name="BEGDATE" value="1/23/2003" />
<input type="text" name="ENDDATE" value="12/31/2003" />
<input type="text" name="AMOUNT" value="12.00" />
<input type="button" value="Update" 
onClick="check2()" />
</form>

Any Javascript experts out there who can figure out what's happening?

Thanks,

Joel

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.