realityshop
Instructor
I have a "registration form page" with numerous text fields,(i work at a school). These fields need "cycle numbers" sent to them via a "cycles page".
The first page, "reg form" opens a popup window with "cycles page" in it. "Cycles page" has buttons with the cycle numbers on them. This same page also has a function with two parameters. One param represents the cycle number to be sent to the reg form. The other param represents the actual Textfield on the reg form that should receive the cycle number. The second param will not work.
On this and other similar functions I get this error;
A runtime error has occured. line 16: bigForm.theCycle is null or not an object.
The first param (with the cycle number) works when i adjust the function to leave out the second param. The second param (naming the desired text field) will not work. The function will send only if i name the field literally, without use of the variable (which i need to do). If I replace theCycle with an actual field name like "t1cycle" -then all is well! Thanks anyone...the function is only 4 lines but i notated efforts as clues. oh boy...
var smallForm;
var bigForm;
var theValue;
var theBox;
function sendHome(theValue, theBox)
{
bigForm = window.opener.document.graphicsform;
smallForm = window.document.form1;
bigForm.theBox.value = theValue;
//WORKS: bigForm.t1cycle.value = theValue;
//WORKS: alert(theBox);
//WORKS: alert(bigForm.name);
//WORKS: alert(window.opener.document.forms[0].name);
/*NOT WORKING: window.opener.document.graphicsform.theBox.value = theValue;*/
//WORKS: alert(smallForm.CGT11M.value);
//WORKS: alert(theBox);
}
and the button...
<input type="button" name="CGT11M" value="CGT1-1M" onclick = "return sendHome('CGT11M', 't1cycle')">
The first page, "reg form" opens a popup window with "cycles page" in it. "Cycles page" has buttons with the cycle numbers on them. This same page also has a function with two parameters. One param represents the cycle number to be sent to the reg form. The other param represents the actual Textfield on the reg form that should receive the cycle number. The second param will not work.
On this and other similar functions I get this error;
A runtime error has occured. line 16: bigForm.theCycle is null or not an object.
The first param (with the cycle number) works when i adjust the function to leave out the second param. The second param (naming the desired text field) will not work. The function will send only if i name the field literally, without use of the variable (which i need to do). If I replace theCycle with an actual field name like "t1cycle" -then all is well! Thanks anyone...the function is only 4 lines but i notated efforts as clues. oh boy...
var smallForm;
var bigForm;
var theValue;
var theBox;
function sendHome(theValue, theBox)
{
bigForm = window.opener.document.graphicsform;
smallForm = window.document.form1;
bigForm.theBox.value = theValue;
//WORKS: bigForm.t1cycle.value = theValue;
//WORKS: alert(theBox);
//WORKS: alert(bigForm.name);
//WORKS: alert(window.opener.document.forms[0].name);
/*NOT WORKING: window.opener.document.graphicsform.theBox.value = theValue;*/
//WORKS: alert(smallForm.CGT11M.value);
//WORKS: alert(theBox);
}
and the button...
<input type="button" name="CGT11M" value="CGT1-1M" onclick = "return sendHome('CGT11M', 't1cycle')">