[thelist] JavaScript - messing with global variables - am I even on the rig ht track?

Joel Canfield joel at spinhead.com
Thu Mar 13 18:37:17 CST 2003


http://magisnetworks.com/gl06.html

I suspect I'm making this much more difficult than it needs to be, or
heading down the wrong path altogether. All criticisms and suggestions
welcome regarding the JavaScript in the above page.

I need to add functionality to our Purchase Request system. For each line
item on the PO form, the user must be able to select a department, a GL
number, and perhaps a sub-GL number. Due to space limitations on the form
(I'd prefer to prevent side-scrolling and general hugeness) I'm messing with
hidden layers, using a button to pop up the first set of radio buttons (the
department) which then unhides the appropriate GL numbers, which, if
necessary, unhide the appropriate sub-GL numbers.

All the hiding and unhiding works as expected, but I can't get the value
selected in the end to write to the correct line of the form. I'm really
fuzzy on global variables, which may or may not be the problem.

I also need the original 'Set the GL number' code to allow for iterating
thru more lines if they're added; the users can save 9 line items as a
draft, recall that draft, and add more items. So, if they've done that, the
first new line is line 10, not line 1, so the numbering being passed around
in the function (between the functions?) must be dynamic.

How do you pass the value of a global variable to a function? Am I
hopelessly lost?

Thanks.

joel


More information about the thelist mailing list