Link to home
Start Free TrialLog in
Avatar of PeterHing
PeterHingFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Script Error

Hiya Guys,

I really need help with this one. Every time I try to select the second drop down box - I get a script error:

'document.formname.manufacturer' is null or not an object

Have a look below and see if you can help me.
Thank You!

Pete


<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 5.0">
<Title></Title>
<SCRIPT LANGUAGE=javascript>

reasons = new Array (3)
reasons [0] = new Array (1)
reasons [1] = new Array (3)
reasons [2] = new Array (4)
reasons [3] = new Array (5)
reasons [4] = new Array (6)
reasons [5] = new Array (7)
reasons [6] = new Array (8)
reasons [7] = new Array (9)
reasons [8] = new Array (10)
reasons [9] = new Array (11)

//Empty (0)
reasons [0][0.0] = " "
reasons [0][0.1] = " "

//Customer Service (1)
reasons [1][0.0] = "CSA Error"
reasons [1][0.1] = "CSA Error"
reasons [1][1.0] = "Unhappy With Complaint Outcome"
reasons [1][1.1] = "Unhappy With Complaint Outcome"
reasons [1][2.0] = "Incorrect Information Given"
reasons [1][2.1] = "Incorrect Information Given"
reasons [1][3.0] = "Rudeness"
reasons [1][3.1] = "Rudeness"

//Personal Circumstance (2)
reasons [2][0.0] = "Tax Reasons"
reasons [2][0.1] = "Tax Reasons"
reasons [2][1.0] = "Never Used The Account"
reasons [2][1.1] = "Never Used The Account"
reasons [2][2.0] = "Consolidate All Funds"
reasons [2][2.1] = "Consolidate All Funds"
reasons [2][3.0] = "Stock Market / ISA"
reasons [2][3.1] = "Stock Market / ISA"
reasons [2][4.0] = "Medical Emergency"
reasons [2][4.1] = "Medical Emergency"
reasons [2][5.0] = "Other"
reasons [2][5.1] = "Other"

//PIN Issue (3)
reasons [3][0.0] = "Moved Address - Cannot Resend"
reasons [3][0.1] = "Moved Address - Cannot Resend"
reasons [3][1.0] = "PIN Too Faint"
reasons [3][1.1] = "PIN Too Faint"
reasons [3][2.0] = "Numbers Missing"
reasons [3][2.1] = "Numbers Missing"
reasons [3][3.0] = "Never Received"
reasons [3][3.1] = "Never Received"
reasons [3][4.0] = "Cannot Activate"
reasons [3][4.1] = "Cannot Activate"
reasons [3][5.0] = "Keep Blocking / Forgetting"
reasons [3][5.1] = "Keep Blocking / Forgetting"

//Needed Funds (4)
reasons [4][0.0] = "Holiday"
reasons [4][0.1] = "Holiday"
reasons [4][1.0] = "Car/Caravan"
reasons [4][1.1] = "Car/Caravan"
reasons [4][2.0] = "Medical Emergency"
reasons [4][2.1] = "Medical Emergency"
reasons [4][3.0] = "Wedding"
reasons [4][3.1] = "Wedding"
reasons [4][4.0] = "Travelling"
reasons [4][4.1] = "Travelling"
reasons [4][5.0] = "House Purchase"
reasons [4][5.1] = "House Purchase"
reasons [4][6.0] = "School Fees"
reasons [4][6.1] = "School Fees"
reasons [4][7.0] = "Other"
reasons [4][7.1] = "Other"

//Account Problems (5)
reasons [5][0.0] = "Direct Debit"
reasons [5][0.1] = "Direct Debit"
reasons [5][1.0] = "Linking Cheque"
reasons [5][1.1] = "Linking Cheque"
reasons [5][2.0] = "Joint Account"
reasons [5][2.1] = "Joint Account"
reasons [5][3.0] = "Moving Money / Hold Period"
reasons [5][3.1] = "Moving Money / Hold Period"
reasons [5][4.0] = "CIF Restrictions"
reasons [5][4.1] = "CIF Restrictions"
reasons [5][5.0] = "Payment Error"
reasons [5][5.1] = "Payment Error"
reasons [5][6.0] = "Never Received Call Back"
reasons [5][6.1] = "Never Received Call Back"

//Interest Rate (6)
reasons [6][0.0] = "The AA"
reasons [6][0.1] = "The AA"
reasons [6][1.0] = "Nationwide BS"
reasons [6][1.1] = "Nationwide BS"
reasons [6][2.0] = "Alliance & Lecister"
reasons [6][2.1] = "Alliance & Lecister"
reasons [6][3.0] = "First Direct"
reasons [6][3.1] = "First Direct"
reasons [6][4.0] = "Egg"
reasons [6][4.1] = "Egg"
reasons [6][5.0] = "IF/Halifax"
reasons [6][5.1] = "IF/Halifax"
reasons [6][6.0] = "Other Bank"
reasons [6][6.1] = "Other Bank"

//IVR Issues (7)
reasons [7][0.0] = "Trouble Setting Up MD"
reasons [7][0.1] = "Trouble Setting Up MD"
reasons [7][1.0] = "Too Long"
reasons [7][1.1] = "Too Long"
reasons [7][2.0] = "Can't Understand It"
reasons [7][2.1] = "Can't Understand It"
reasons [7][3.0] = "Other"
reasons [7][3.1] = "Other"

//KYC Issues (8)
reasons [8][0.0] = "Doesn't Want To Send Docs"
reasons [8][0.1] = "Doesn't Want To Send Docs"
reasons [8][1.0] = "Documents Returned"
reasons [8][1.1] = "Documents Returned"
reasons [8][2.0] = "No Letter Sent"
reasons [8][2.1] = "No Letter Sent"
reasons [8][3.0] = "Taking Too Long"
reasons [8][3.1] = "Taking Too Long"
reasons [8][4.0] = "Other"
reasons [8][4.1] = "Other"

//Web Issues (9)
reasons [9][0.0] = "Security Fears"
reasons [9][0.1] = "Security Fears"
reasons [9][1.0] = "Hard To Use"
reasons [9][1.1] = "Hard To Use"
reasons [9][2.0] = "Can't Login"
reasons [9][2.1] = "Can't Login"
reasons [9][3.0] = "Other"
reasons [9][3.1] = "Other"


//Next, we create a function to fill the second drop down from
//the array based on the item selected in the first drop down.

function FillList()
{
var num=document.formname.manufacturer.selectedIndex
var boxlength = 0

document.formname.reasons.selectedIndex = 0
for ( ctr=0;ctr<reasons[num].length;ctr++)
 {
 boxlength++;
 document.formname.reasons.options[ctr] = new Option(reasons[num] [eval(ctr + ".1")], reasons[num][eval(ctr + ".0")]);
 }

document.formname.reasons.length = boxlength;
document.formname.reasons.options.length = boxlength;
document.formname.reasons.focus() ;

}

</script>
</head>

<body>

<p align="center">
<img border="0" src="ING%20Direct.jpg" width="408" height="68"></p>
<p align="center"><b><font face="Trebuchet MS" size="6">Saves</font></b></p>
<p align="center"><font face="Trebuchet MS">Use this form to tell us about the
customer you just saved!</font></p>
<p align="center"><font face="Trebuchet MS">Remember, a successful save means
you'll be credited with <b>£5!</b></font></p>
<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" u-file="C:\Documents and Settings\HingP\Desktop\_private\form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p align="center">
  <font face="Trebuchet MS">Name</font> <font face="Trebuchet MS" size="1">
  (Piggy Bank)</font><br>
  <input type="text" name="T1" size="20"></p>
  <p align="center"><font face="Trebuchet MS">Date <font size="1">(DD/MM/YY)<br>
  <input type="text" name="T2" size="20"></font></font></p>
  <p align="center"><font face="Trebuchet MS">Time Of Call <font size="1">(HH:MM)<br>
  <input type="text" name="T3" size="20"></font></font></p>
  <p align="center"><font face="Trebuchet MS">CIF <font size="1">(All 9 Digits)</font></font><br>
  <input type="text" name="T4" size="20"></HEAD><BODY></body></p>
 
 
 
<p align="center">
<SELECT id=select1 name=manufacturer onChange="JavaScript:FillList()">
<OPTION value=""></OPTION>
<OPTION value=Customer_Service>Customer Service</OPTION>
<OPTION value=Personal_Circumstance>Personal Circumstance</OPTION>
<OPTION value=PIN_Issue>PIN Issue</OPTION>
<OPTION value=Needed_Funds>Needed Funds</OPTION>
<OPTION value=Account_Problems>Account Promblems</OPTION>
<OPTION value=Interest_Rate>Interest Rate</OPTION>
<OPTION value=IVR_Issues>IVR Issues</OPTION>
<OPTION value=KYC_Issues>KYC Issues</OPTION>
<OPTION value=WEB_Issues>Web Issues</OPTION>

</SELECT> </p>
 
</p>
 
<p align="center">
<SELECT id=select2 name=reasons>
<OPTION></OPTION>
</SELECT>

</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
Avatar of dakyd
dakyd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just replace the definition of the form as described below :
<form method="POST" name="formname" action="--WEBBOT-SELF--">
Avatar of jessegivy
if this is the source code and not some derivation you also need to add quotes around the name and id values for both of your select boxes.

I don't think it really matters if your not using a server technology but I know that with ASP.NET the id and name parameters must match or the compiler gets confused.  Is there a reason for the difference?  ie id=select1 and name=manufacturer.

...anyway, just a few things I noticed when skiming your code.  the other guys were totaly right though.  just add a name for your form and you should be fine.  It gets tough sometimes entering text from a book.  Can't tell when they want you to insert a variable name you define or when it actually is the name of the object!!!

Hang in there!
Normal Front page trash. I don't know why anyone ever expects Frontpage code to actually work correctly.  You could not write much worse trash even if you set out to do it.

You should probably run it through validator after adding th edoctype that FP leaves out, just to see if that is the only problem you have with the page.

Cd&