• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Javascript error in Mac OS 9 IE 5

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

I have a weired problem. I have a script that runs perfectly well on Win+IE5, but fails in MacOS9+IE5.

The following assignment is used in submitRequest() function :

var result= allForms["RESULT_FORM"][0];

This thing works fine in Win+IE5, but in MacOS9+IE 5 we get the following JS error : allForms.RESULT_FORM.0 is not an object.

I can not understand why this thing is happening.

I would appreciate if you can give some guidance.

--Ved
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bad formatting:

when you reference a form element, it should be

document.formName.elementName

or

document.Forms["name or number"].elements["name or number"]

I am not sure what you are doing with your syntax there?

Eric
 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric, Thanks a lot for your help.

The major code is like this

In the HTML file I have the following JS Functions
--------------------------------------------------
/* Initializes the 'allForms' arry */
function initialize(doc)
{
top.initDocument(doc);
}

function submitForm(){
top.submitRequest("aaa",
url,
action,
func,
"",
new Array(""),
"_top");

}
...
/* Later I have the following Form in the same HTML */
/* The Hidden input are null and haveing name as null too will this create any problems ? */

<form name="RESULT_FORM" method=POST>
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
</form>
---------------------------------------------------------------------
The function 'initDocument()' creates the allForms array of forms and the 'submitRequest()' method submits the record. While submitting the
form, we get the error in IE5+MacOS 9
---------------------------------------------------------------------
Code of submitRequest() is something like :
---------------------------------------------------------------------
function submitRequest( url, //Url to submit to
generalData, //Some other data
formNames, //Forms to be submitted
target,
method) // request method for form.
{

//We get the form here

var result= allForms["RESULT_FORM"][0];

result.action= url;
result.target= target;
result.method= ((method=="GET" || target=="por_main") ? "GET" : "POST");
//we populate all the elements of the forms to be submitted to
//'result' object and then submit it
//Probably the point of error
result.submit();
}
---------------------------------------------------------------------
I think the problem is with the syntax of the last time 'result.submit();'
This works well in IE 5+ Win and fails saying
'RESULT_FORM.0 is not an object'


Please help.

--Ved Antani
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
var result= allForms["RESULT_FORM"][0];

should be

var result = document.RESULT_FORM;
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic