/    Sign up×
Community /Pin to ProfileBookmark

Object does not support this property or method

I’m getting an “object does not support this property or method” error on this line AFTER I click the button.

document.getElementById(“txtNewOwner”).value = document.getElementByID(“cboExpertID”).value;

Below is the rest of the code. Anyone know what causes this error or why it might be occuring? Thanks.

[CODE]
<!–#includes file=”header.asp”–>

<head>
<title>Untitled Document</title>
</head>
<body>

<%
‘Declare variables
Dim CN, RS, RSExpert, vSQLJoin
Dim vCaseNumber, vNewAreaExpertiseID, vNewExpertID

‘GetDataConnection lives in the header file
Set CN = GetDataConnection

If Request.Form(“cboCaseNumber”) <> “” Then
vCaseNumber = stripquotes(Request.Form(“cboCaseNumber”))
End If

If Request.Form(“cboAreaExpertiseID”) <> “” Then
vNewAreaExpertiseID = stripquotes(Request.Form(“cboAreaExpertiseID”))
End If

If Request.Form(“cboExpertID”) <> “” Then
vNewExpertID = stripquotes(Request.Form(“cboExpertID”))
End If
%>

<form name=”frmResearch” id=”frmResearch” method=”post”>
<!– Reassign Case –>
<table width=”99%” border=”0″ cellspacing=”2″ cellpadding=”2″>
<tbody id=”tblReassign” name= “tblReassign”>
<tr>
<td><h4>Reassign Case</h4></td>
</tr>
<tr>
<td>
<p>Select Area of Expertise:</p>
<p>
<select name=”cboAreaExpertiseID” id=”cboAreaExpertiseID” onChange=”displayArea(this);”>
<option></option>
<%
Set RS = CN.Execute (“Select AreaExpertiseID, Area From FRAreaExpertise Order By Area ASC”)
If Not RS.EOF Then
Do While Not RS.EOF
%>
<option value='<%= RS.Fields(“AreaExpertiseID”)%>'<%If vNewAreaExpertiseID = stripquotes(RS.Fields(“AreaExpertiseID”)) Then Response.Write “selected” %>><%= RS.Fields(“Area”)%></option>
<%
‘Get next record
RS.MoveNext
Loop
End If
%>
</select>
</p></td>
</tr>
</table>

<table width=”99%” border=”0″ cellspacing=”2″ cellpadding=”2″>
<tbody id=”tblExperts” name= “tblExperts” style=”display: <%If vNewAreaExpertiseID = “” Then Response.Write “none”%>”>
<tr>
<td><p>Select Researcher:</p>
<p>
<select name=”cboExpertID” id=”cboExpertID”>
<option></option>
<%
If vNewAreaExpertiseID <> “” Then

‘Select experts and limit the number of cases experts are allowed.
Set RSExpert = CN.Execute (“spFRSelectExperts ‘” & vNewAreaExpertiseID & “‘”)
If Not RSExpert.EOF Then
Do While Not RSExpert.EOF

‘IsMaxedOut is the column that stores whether or not a particular expert has exceeded the maximum cases allowed.
If RSExpert.Fields(“IsMaxedOut”) = 1 Then
%>
<option value=’-1′ disabled <%If vNewAreaExpertiseID = stripquotes(RSExpert.Fields(“AreaExpertiseID”)) Then Response.Write “selected” %>><%= RSExpert.Fields(“ExpertLastName”)%>, &nbsp;<%= RSExpert.Fields(“ExpertFirstName”)%></option>
<%
Else
%>
<option value='<%= RSExpert.Fields(“ExpertID”)%>’><%= RSExpert.Fields(“ExpertLastName”)%>,&nbsp;<%= RSExpert.Fields(“ExpertFirstName”)%></option>
<%
End If
‘Get Next Record
RSExpert.MoveNext
Loop
End If

End If
%>
</select>
<input name=”txtNewOwner” type=”text” value=”‘<%= vNewExpertID %>'”></p>
<p>
<input type=”submit” class= “button” onClick=”verifyReassignment();” value=”Reassign Case”>
</p>
</td>
</tr>
</tbody>
</table>
</form>

<%
‘Close objects
Set RS = Nothing
Set RSExpert = Nothing
CN.CLose
Set CN = Nothing
%>

</body>

<script language=”javascript”>

//Display comb box to select area of expertise.
function displayArea(obj)
{
var area = obj.options[obj.selectedIndex].value;
var submitForm = document.getElementById(“frmResearch”);

if ( area != “” )
{
document.getElementById(“tblExperts”).style.display = “”;
}

else
{
document.getElementById(“tblExperts”).style.display = “none”;
}

submitForm.submit();
}

function verifyReassignment()
{
var answer = confirm(“Are you sure you want to reassign this case?”);
var submitReassignment = document.getElementById(“frmResearch”);

if (answer)
{
alert(document.getElementById(“cboExpertID”).value);
document.getElementById(“txtNewOwner”).value = document.getElementByID(“cboExpertID”).value;
alert(“This case has been reassigned.”);
submitReassignment.action = “ip_resources_research_post.asp”;
submitReassignment.submit();
}
else
{
alert(“Case will not be reassigned.”)
}
}

</script>
</html>

[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisNov 26.2008 — A select element does not have a "value" parameter. It has options that have values. You have to use selectedIndex to find out which option is chosen (if any) and get the value.
document.frmResearch.txtNewOwner.value = document.frmResearch.cboExpertID[document.frmResearch.cboExpertID.selectedIndex].value;BTW, you do not have an id assigned to txtNewOwner, just a name. Some browsers will assign the name parameter to the id if there is no id specified, but I don't know if it is reliable on all browsers to use getElementId() using the name parameter.
Copy linkTweet thisAlerts:
@baldwingrandauthorNov 30.2008 — This worked great; thanks! And thanks for the suggestion to add an ID to the text field. This will probably save me some future problems. Thanks!
×

Success!

Help @baldwingrand spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...