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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a hidden form element value

Status
Not open for further replies.

aztarac

Programmer
Jan 31, 2007
6
GB
Hi y'all !

I'm an absolute ASP newbie and need some help.
I want to be able to change a hidden form element value on an ASP page.
The following generates this error:

Microsoft VBScript runtime error '800a01a8'
Object required: ''
/test.asp, line 13

Maybe 'document' is wrong but it would work in VBScript on client side.

Thanks in advance for any help.
----------------------------------------------

<html>
<head>
<title>Test Page 1</title>
</head>
<body>

<form method="POST" action="--WEBBOT-SELF--">
<input type="hidden" name="test" value="xxx">
</form>
</body>

<%
document.GetElementById( "test" ).value = "hello"
%>

</html>
 
Neither the form element nor the document object exists on the server, which is where you are trying to change them with your script. Once the web page has been served to the client, the Active Server Pages script does not exist and cannot affect anything.

Lee
 
Code:
<%
document.GetElementById( "test" ).value = "hello"
%>
You have to put that in <script> tags and NOT escape into server side (eliminate <% and %>)

<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top