Forum Moderators: open
example 1:
---------------------------------------------------
<html>
<form action="my.asp" method=POST name="form1">
<INPUT type="text" name="EmployeeID" size="14">
</form>
<%
'vb code here
Dim EID
EID = document.form1.EmployeeID.value
%>
</html>
---------------------------------------------------
for the example 1 page, I am getting the following error message in the browser:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
In a VBscript sub routine on a regular webpage, I can access webpage objects in that page all day long.
example2:
-------------------------------------------
<html>
<SCRIPT LANGUAGE="VBSCRIPT">
Sub btn_onclick()
document.form1.EmployeeID.value = "12345"
checkme = document.form1.EmployeeID.value
MsgBox "The Employee ID is " & checkme & " ",0,"VBScript Example"
End Sub
</SCRIPT>
<form action="my.asp" method=POST name="form1">
<INPUT type="text" name="EmployeeID" size="14">
</form>
</html>
---------------------------------------------------
example2 works great.
I have done some research and I can’t seem to find a way to make what I am trying to do in example1 work.
It has something to do with scope, any thing I create in the VB script code I can work with in that code, (I can create and write out a form from within the VBcode and assign values to it) but the elements of the webpage that are outside the vbscript code I cant get to to save my life.
Any guidance on this would be greatly appreciated.
thanks -
I don't have any problem getting data from the form once it has been submitted, via the request object like you mentioned...
I am trying to update a field in the form with data I look up from the db in the vbcode... (see example1). I want to write a value into the form field based on what I look up in the vb code.
thanks for your reply.
Example1 is what I want to do, Example2 was what I can do, (but Example2 doesn't help me with the error I get in Example1). If that makes any sense.
I want to use the ASP page to look up a value from the DB, and then I need to put that value in a form on that page. I cant get that to work.
the form is outside of the script, and I cant access it from within the script.
example 1:
---------------------------------------------------
<html>
<form action="my.asp" method=POST name="form1">
<INPUT type="text" name="EmployeeID" size="14">
</form>
<%
'vb code here
Dim EID
EID = document.form1.EmployeeID.value
%>
</html>
---------------------------------------------------
This is what I am trying to do, write the EID value into the form that is outside the script. Wont work. I get a Microsoft VBScript runtime error '800a01a8'
Object required error...
thanks again for your replies.
I am working on a workaround, but I am having to re-code the entire ASP page to get around not being able to update the value in that form.
In my code above I am trying to read the form value into the code, which also doesnt work.
The case I have been describing would be like this:
document.form1.EmployeeID.value = EID
(trying to set the form value to be equal to the value I look up in the db).
Sorry, I had that backwards. So far, it wont work either way.
If you just want the textbox to have the db value as a default value, you can use:
<INPUT type="text" name="EmployeeID" size="14" value=""<% = EID %>">
If you want the db value to be inserted by client side script, you could write the EID value into that script directly:
Sub btn_onclick()
document.form1.EmployeeID.value = "<% = EID %>"
...
BTW: HTH = Hope This Helps :)