Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined error message

Status
Not open for further replies.

janise

Technical User
May 25, 2003
161
US
I am getting the following error when I try running the code below.
First the error:

line: 10
Error: 'edit' is undefined

Line 10 is this line:
<select name=&quot;classcode&quot; onchange=&quot;javascript:edit.submit();&quot;>

Below is the entire code:

page1:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<title>A different Edit Screen</title>
<script language=&quot;javascript&quot;>
function editClass()
{
window.open(&quot;file2.asp?name=&quot; + editFrm.txtClassCode.value, &quot;edit&quot;, &quot;toolbar=0, menu=0, scrollbars=0&quot;)
}
</script>
</HEAD>
<BODY>
<form name=&quot;editFrm&quot; method=&quot;POST&quot;>
<table border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;>
<tr>
<td>Enter the Class Code : </td>
<td><input type=&quot;text&quot; name=&quot;txtClassCode&quot; size=&quot;20&quot; /></td>
<td colspan=&quot;2&quot;><input type=&quot;button&quot; name=&quot;btnSubmit&quot; value=&quot;Submit&quot; onclick=&quot;javascript: editClass();&quot;/></TD>
</tr>
</table>
</form>
</BODY>
</HTML>

************************************

Page2:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<title>Edit Details Screen</title>
</HEAD>
<BODY>

<%
Dim oConn , ORs, ConStr
ConStr = &quot;dsn=safe&quot;
Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.ConnectionString = ConStr
oConn.Open

Set oRs = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
ORs.Open &quot;Select name from guestbook Where name LIKE '%&quot; & Request(&quot;class&quot;) & &quot;%'&quot;, oConn

%>
<form name=&quot;file2&quot; action=&quot;updateJob.asp&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;class&quot; value=&quot;<%=Request(&quot;class&quot;)%>&quot; />
<select name=&quot;classcode&quot; onchange=&quot;javascript:edit.submit();&quot;>
<%
while not ORs.EOF
Response.Write &quot;<option value='&quot; & ORs.Fields(0) & &quot;'>&quot; & ORs.Fields(0) & &quot;</option>&quot;
ORs.MoveNext
Wend

IF Request.Form(&quot;classcode&quot;) <> &quot;&quot; Then
ORs.Open &quot;Select * from guestbook Where name='&quot; & Request.Form(&quot;classcode&quot;) & &quot;'&quot;, oConn
while not ORs.EOF
txttile = ORs.Fields(&quot;country&quot;)
txtdate = ORs.Fields(&quot;dte&quot;)
txtname = ORs.Fields(&quot;name&quot;)
ORs.MoveNext
Wend
End if
%>
</select><br>
<input type=&quot;text&quot; name=&quot;txttitle&quot; value=&quot;<%=txttitle%>&quot; /><br>
<input type=&quot;text&quot; name=&quot;txtdate&quot; value=&quot;<%=txtdate%>&quot; /><br>
<input type=&quot;text&quot; name=&quot;txtname&quot; value=&quot;<%=txtname%>&quot; /><br>
<input type=submit name=&quot;update&quot; value=&quot;save&quot;><br>
</form>
</BODY>
</HTML>

I will appreciate any help
 
first of all what are you trying to submit?

if it is the form in the second file you will need to write:

<select name=&quot;classcode&quot; onchange=&quot;javascript:document.file2.submit();&quot;>

The error is saying it doesn't recognize 'edit' as a variable or object name. That is because it is the name of the window. To access the window via javascript you will have to assign the window.open statement to a variable:

objEditWin = window.open(&quot;file2.asp?name=&quot; + editFrm.txtClassCode.value, &quot;edit&quot;, &quot;toolbar=0, menu=0, scrollbars=0&quot;)

now you can say:

objEditWin.document.formname.submit() if you need to.

hope that helps
 
Thank you so so much for your help and explanation.
Now, after making that change, the error disappeared.
However, on the dropdown, when I try to select a different value from the dropdown, instead of giving me the value and populating the rest of the textboxes with records associated with the classcode, i am taking to a different page as though the update was made.
Any help in figuring this out will be really appreciated.
This problem is happening on page2.

There are a total of 3 pages.
The page not included is the update page which is fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top