Microsoft JScript runtime error: 'this.form.cboContacts' is null or not an object
Posted on 2004-04-20
I'm having a spot of bother with an object on my webpage which generates the following error
"Microsoft JScript runtime error: 'this.form.cboContacts' is null or not an object"
Now the object in question, cboContacts does exist. In HTML its a SELECT/OPTION as follows:
<select name="cboContacts" id="cboContacts" class="label" OnFocus="alert(this.name)" style="height:16px;width:256px;">
<option selected="selected" value="0"></option>
<option value="9999">~*~ Admin ~*~</option>
<option value="1">Surname1, FirstName1</option>
<option value="2">Surname2, FirstName2</option>
I added the OnFocus event to see if the object was recognised, and obviously it gave a popup message containing "cboContacts".
I want the hyperlink to test if a value has been selected (other than the empty first option), and if one has to question the user if he wished to continue to receive the email reminder. The href of the hyperlink executes codebehind code which queries the database to obtain the selected users email address and posts them their email.
Why is it failing and how do I fix this?