Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

javascript functions don't work

New Here ,
Apr 03, 2007 Apr 03, 2007

Copy link to clipboard

Copied

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
TOPICS
Server side applications

Views

294
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2007 Apr 03, 2007

Copy link to clipboard

Copied

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
>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 03, 2007 Apr 03, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2007 Apr 03, 2007

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines