"Object Required" error

D

DaFallus

I'm trying to write a somewhat simple page with dependent drop-down
boxes. Unfortunately the entire page is written through PL/SQL so that
makes it even more difficult for me to trouble shoot. I know hardly
anything when it comes to JavaScript, and I keep getting an error
saying:
"Error: Object required
Line: 31
Char: 1
Code: 0"

The funny thing is that I ONLY get this error with Internet Explorer.
The page works just fine in Firefox but most of my clients will be
using IE so this has been driving me nuts. Here is the code on the page
that is throwing the error (the page is displayed in a hidden frame).

<script language="javascript">
function lookUp( cntry_name )
{
document.forms[0].p_cntry_name.value = cntry_name;
document.forms[0].submit();
}
</script>

<script language="javascript">
function lookUpCounty( state_name )
{
document.forms[0].p_state_name.value = state_name;
document.forms[0].submit();
}
</script>

<script language="javascript">
function lookUpWell(welltype)
{
document.forms[0].well_type.value = welltype;
document.forms[0].submit();
}
</script>
<FORM ACTION="dev_dcd.frame_hidden" METHOD="POST">
<INPUT TYPE="hidden" NAME="p_cntry_name" VALUE="">
<INPUT TYPE="hidden" NAME="p_state_name" VALUE="">
<INPUT TYPE="hidden" NAME="p_county_name" VALUE="">
</FORM>
<script language="javascript">
with( parent.mainFrame )
{
addToList( "No Options", "" );
document.forms[0].p_county_name.length = 0;
addCounty( "No Options", "" );
document.forms[0].p_county_name.selectedIndex = 0;
}
</script>

Any help will be greatly appreciated!
 
V

VK

DaFallus said:
"Error: Object required
Line: 31
Char: 1
Code: 0"

The funny thing is that I ONLY get this error with Internet Explorer.

You get the same kind of error in Firefox either. The reason you don't
see it is that Firefox silently registers JavaScript errors into
JavaScript console (select Tools > JavaScript Console and here we are).

Both are complaining on the line
with( parent.mainFrame )
because indeed there is no such object on a stay-alone page (not
uncluded into frameset with a frame named mainFrame).
If this is indeed a frameset, it is necessary to see it in whole.
 
D

DaFallus

I'm not exactly sure what you mean. Do I need to use
parent.frames['frame_main'] instead of parent.mainFrame. As I
understand it a "with" statement changes the scope so that you don't
have to write the full path of an object. Like I said, I don't really
know much about JavaScript so if you could offer some more specific
advice I'd really really appreciate it.

Also, I do see now that Firefox is receiving errors, and they are more
detailed than the errors IE is giving me. However, why is it that the
page functions normally in Firefox despite these JavaScript errors and
IE won't let me submit the page?
 
V

VK

DaFallus said:
I'm not exactly sure what you mean. Do I need to use
parent.frames['frame_main'] instead of parent.mainFrame.

I mean to say that in the posted code you are trying to communicate
with some objects (function, form, form elements) located on another
HTML page - in the frame called "mainFrame". If it is the case then I
need to see the whole frameset structure, thus the page containing
<frameset>
....
</frameset>
definition as well as the content of the page you are trying to
communicate with (the one named "mainFrame")

If you don't have a page with a frameset definition and the originally
posted code supposes to run on a stay-alone page, then your usage of
parent.frames[frameName] construct is wrong and you are thinking of
"parent" and "frame" something what they are not. In this case please
post in full the problematic page (or give a link to it).
 
D

DaFallus

If you don't mind, I'd like to email the code to you since all three
pages together is just over 200 lines.
DaFallus said:
I'm not exactly sure what you mean. Do I need to use
parent.frames['frame_main'] instead of parent.mainFrame.

I mean to say that in the posted code you are trying to communicate
with some objects (function, form, form elements) located on another
HTML page - in the frame called "mainFrame". If it is the case then I
need to see the whole frameset structure, thus the page containing
<frameset>
...
</frameset>
definition as well as the content of the page you are trying to
communicate with (the one named "mainFrame")

If you don't have a page with a frameset definition and the originally
posted code supposes to run on a stay-alone page, then your usage of
parent.frames[frameName] construct is wrong and you are thinking of
"parent" and "frame" something what they are not. In this case please
post in full the problematic page (or give a link to it).
 
V

VK

DaFallus said:
If you don't mind, I'd like to email the code to you since all three
pages together is just over 200 lines.

Go ahead. My address in this group is a real one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top