Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2004, 08:44 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form value in For statement

I have a dynamic table that I built using for statments that lies in a form. For the submit button, I am calling a function from the head. Here is the function..

var changecounter;
function change()
    {
        for(changecounter=0; changecounter < window.parent.ID.length; changecounter++)
        {
            var boolvalue = window.parent.ID[changecounter][4];
            bOptionSet(window.parent.type,window.parent.ID[changecounter][0],frmAlert.boolvalue.value);
            switch (sOptionLastStatus())
            {
                case "OK":
                    break;
                case "NS":
                    alert("You currently do not have the security to update system option " + window.parent.ID[changecounter][1] + ". To proceed, go to the Eagle Browser and sign on as a user with security to update Options Configuration.");
                    break;
                case "NO":
                    alert("Unknown Error occurred while attempting to change " + window.parent.ID[changecounter][1] + ". Please make a note of what you were doing when this error occurred, and send it in an email to [email protected].");
                    break;
                default:
                    alert("Unknown Error occurred while attempting to change " + window.parent.ID[changecounter][1] + ". Please make a note of what you were doing when this error occurred, and send it in an email to [email protected].");
                    break;
            }
        }
    }

I am getting the error that frmAlert.boolvalue.value is null or not an object. Can anyone point me in the right direction?

Clay Hess
__________________
Clay Hess
 
Old June 15th, 2004, 08:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

So... what is frmAlert supposed to be?

Snib

<><
 
Old June 15th, 2004, 08:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ahh.... I'm tired, it's probably a form, right?

Is frmAlert the ID of the form?

Try this instead:

document.forms.frmAlert.boolvalue.value

Is boolvalue the ID of an input?



Snib

<><
 
Old June 15th, 2004, 09:09 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

frmAlert is the ID of the form.

boolvalue is a variable defined as follows...

var boolvalue = window.parent.ID[changecounter][4];

The above corresponds to boolean drop down boxes within the dynamic form. Basically it is the name of the boolean boxes.

Quote:
quote:Originally posted by Snib
 Ahh.... I'm tired, it's probably a form, right?

Is frmAlert the ID of the form?

Try this instead:

document.forms.frmAlert.boolvalue.value

Is boolvalue the ID of an input?



Snib

<><
Clay Hess
 
Old June 15th, 2004, 09:36 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You remember how I said I'm tired?

I completely missed this line:
var boolvalue = window.parent.ID[changecounter][4];

LOL. My apologies.

OK, so let me get this straight. You are referring to a form that is in the parent frame. So what exactly is ID? Sorry if this is another dumb question.

Are you expecting to find a defined variable as an element(?) of a form?

Thanks for your patience :-)

Snib

<><
 
Old June 15th, 2004, 10:50 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

No problem on being tired. I know what it is like coding all day...LOL.

Here is what I am doing. I have an external js file tied to the parent frame. I am using a for statement to build a dynamic table in a form using info from the external js file that is tied to the parent frame. I have function called change() that is also using a for statement to submit the values of boolean dropdowns in the table. These drop downs are assigned names dynamically from the external js file attached to the parent. I am attempting to use those dynamic names in my change() code, but it is giving me the error described previously. Thoughts?


Quote:
quote:Originally posted by Snib
 You remember how I said I'm tired?

I completely missed this line:
var boolvalue = window.parent.ID[changecounter][4];

LOL. My apologies.

OK, so let me get this straight. You are referring to a form that is in the parent frame. So what exactly is ID? Sorry if this is another dumb question.

Are you expecting to find a defined variable as an element(?) of a form?

Thanks for your patience :-)

Snib

<><
Clay Hess
 
Old June 16th, 2004, 01:28 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

Do you think I am getting the error because the boolean drop down box is created dynamically?

Clay Hess
 
Old June 16th, 2004, 02:27 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Wouldn't you use the ID instead of the NAME to reference the drop down?

HTH,

Snib

<><
 
Old June 21st, 2004, 04:43 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Yes I am agreed with the Snib I think he is using ID instead of the NAME to reference the drop down
If so then change the Id into name

Love 4 all





Similar Threads
Thread Thread Starter Forum Replies Last Post
IF ELSE Statement webXtreme ASP.NET 1.0 and 1.1 Basics 0 February 8th, 2007 12:36 PM
Help with if statement voskoue Access VBA 8 February 6th, 2007 04:02 AM
Like Statement Nitin_sharma Oracle ASP 2 May 10th, 2005 12:18 AM
IF statement crmpicco Classic ASP Databases 1 January 25th, 2005 07:09 AM
If Statement Help bjackman Access VBA 3 November 19th, 2003 02:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.