473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Javascript - another Object Expected error when executing javascript function

I am having a problem running a javascript function as part of an html-el:form onsubmit. The problem seems to exists in IE6 but not in Firefox.

html:
Expand|Select|Wrap|Line Numbers
  1. <html-el:form action="${target}" onsubmit="return testTheForm(this)">
  2.  
javascript function:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function testTheForm(theForm){
  3.  var e;
  4.  for (i=0; i<theForm.elements.length; i++){
  5.   e = theForm.elements[i];
  6.   if (e.nodeName == 'SELECT')
  7.   { if (!e.disabled && e.selectedIndex == -1){return false;} }
  8.  }
  9.  return true;
  10. }
  11. </script>
  12.  
When I click on the Submit button I get Error on Page that displays an Object Expected error.

This works fine on Firefox as well as when I put the code inline as part of the onsubmit:
Expand|Select|Wrap|Line Numbers
  1. <html-el:form action="${target}" onsubmit="for (i=0; i<this.elements.length; i++){
  2.   var e = this.elements[i];
  3.   if (e.nodeName == 'SELECT')
  4.   { if (!e.disabled && e.selectedIndex == -1){return false;} }
  5.  }return true;">
  6.  
Note the javascript function is declared in the same .jsp as the html-el:form tag.

Any ideas? I have googled this error with no satisfactory solutions yet.

Thanks.

-Tim
Aug 9 '07 #1
1 2599
pbmods
5,821 Expert 4TB
Heya, Tim. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Do you get a line number with the error?

Try alert()ing the name of each element until you get the error:
Expand|Select|Wrap|Line Numbers
  1. for (i=0; i<theForm.elements.length; i++){
  2.     alert(theForm.elements[i].nodeName);
  3.  
Aug 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.