Skip to main content
Known Participant
April 3, 2007
Question

javascript functions don't work

  • April 3, 2007
  • 3 replies
  • 329 views
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>

Thanks

Fifi
This topic has been closed for replies.

3 replies

Inspiring
April 3, 2007
envision3d wrote:

> you might want to try putting language="javascript" in the script tag.

That's deprecated:
http://www.w3.org/TR/html4/interact/scripts.html
W3C says "type" attribute is needed, but it really isn't.

Mick
Inspiring
April 3, 2007
you might want to try putting language="javascript" in the script tag.
Inspiring
April 3, 2007
fifo85 wrote:

> 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>


onload=function(){
document.forms["SubForm"].elements["SubGroupDD"].disabled =
!(ParentValue == "Y")

}
This will disable SubGroup if "ParentValue" is not "Y"

Mick
>
> 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>
>
> Thanks
>
> Fifi
>