|
I entered this into my HTML editor and then ran it... No problems <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> -Bob Cozzi -----Original Message----- From: web400-bounces@midrange.com [mailto:web400-bounces@midrange.com] On Behalf Of jrc@e-masi.com Sent: Friday, January 24, 2003 7:28 AM To: web400@midrange.com Subject: [WEB400] Going Javascript crazy... 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 _______________________________________________ This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a message email: WEB400@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo.cgi/web400 or email: WEB400-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
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.