Skip to main content
Known Participant
April 2, 2007
Question

JScript error : Object expected.

  • April 2, 2007
  • 4 replies
  • 952 views
Hi,

Can someone please help me out here.
I am using asp javascript to develop my web page, i have the following function
defined in the head section of the page:

<head>
<script type="text/javascript">
function DisableSubGroup()
{
document.getElementById("SubGroupDD").disabled = "disabled";
}
</script>
</head>

I call the function from within my code in the following way.

<form action="CategoryListing.Mod.asp" method="post" name="SubForm" target="_self" id="SubForm">
<p>
<% if(ParentValue == String("Y"))
{
DisableSubGroup(); //Function call
}
%>
<select name="SubGroupDD" class="DefaultShortBox" id="SubGroupList" onchange="SubForm.submit()"
option selected= "<%Session("ActiveCategory")%>">

When i run it i get the following error every time..

Error Type:
Microsoft JScript runtime (0x800A138F)
Object expected
/DCASuppliersDatabase/CategoryListing.Mod.asp, line 218

What does it mean?
How do i get rid of it?
Regards

fifo
This topic has been closed for replies.

4 replies

Inspiring
April 2, 2007
Yes, that's the way to do it. Execute the client-side code on the client.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004





fifo85Author
Known Participant
April 3, 2007
Hi,

I have just tried the following code putting the script header to execute it on the client side:
<script>
if(ParentValue == String("Y"))
{
EnableSubGroup();
}
else
{
DisableSubGroup();
}
</script>

I do not get the object expected error anymore
but the functions don't work, why is this?

----Function definition ------
<script type="text/javascript">
function EnableSubGroup()
{
document.forms["SubForm"].elements["SubGroupDD"].disabled='false';
}
function DisableSubGroup()
{
document.forms["SubForm"].elements["SubGroupDD"].disabled='true';
}
</script>
Inspiring
April 2, 2007
Julian Roberts wrote:

> You cannot call client side functions on the server.
>
<script>
<?php echo "x=".$_GET["var"] ?>
function foo(){
if(x && x=="bar"){
alert(x)
}
}
foo()
</script>
Mick
Inspiring
April 2, 2007
fifo85 wrote:

> Hi,
>
> Can someone please help me out here.
> I am using asp javascript to develop my web page, i have the following function
> defined in the head section of the page:
>
> <head>
> <script type="text/javascript">
> function DisableSubGroup()
> {
> document.getElementById("SubGroupDD").disabled = "disabled";
> }

Normally the disabled property is Boolean
document.getElementById("SubGroupDD").disabled = true;

> </script>
> </head>
>
> I call the function from within my code in the following way.
>
> <form action="CategoryListing.Mod.asp" method="post" name="SubForm"
> target="_self" id="SubForm">
> <p>
> <% if(ParentValue == String("Y"))
> {
> DisableSubGroup(); //Function call
> }
> %>

I'm not a vb/asp person, but I imagine that you can only make the call
to the DisableSubGroup() function *after* the element is writtten to the
document.



> <select name="SubGroupDD" class="DefaultShortBox" id="SubGroupList"
> onchange="SubForm.submit()"
> option selected= "<%Session("ActiveCategory")%>">

You are missing the closing ">" from the select tag, and the opening "<"
from the option tag.
And "SubForm.submit()" should be:
"this.form.submit()"
or
"document.SubForm.submit()"

Mick


>
> When i run it i get the following error every time..
>
> Error Type:
> Microsoft JScript runtime (0x800A138F)
> Object expected
> /DCASuppliersDatabase/CategoryListing.Mod.asp, line 218
>
> What does it mean?
> How do i get rid of it?
> Regards
>
> fifo
>
>
Inspiring
April 2, 2007
You cannot call client side functions on the server.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004