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

Client-Side VBScript and form handling

Status
Not open for further replies.

AncientTiger

Programmer
Jul 5, 2001
238
US
How do you gather form results using CLIENT side VBscript???
I've tried everything I know, request.form("somevar"), request.querystring("somevar"), even just request("somevar").... I keep getting errors on the request object. Is there a different object to use in the client side environment other than REQUEST?

I'll probably also need advice on how to gather the url field contents. I know in server side script it's request.querystring("somevar"), but that ain't workin' in client side.....

Thanks!!
AT
 
There is no request object in the client side . U need to use form object for it as :

document.form("formname").somevar.value

gives u the value.
 
Didn't work. Give a "Object doesn't support this property or method: 'document.form'" error.

Here's the two pages that I've got. The first is the form, the second is the form hanlder:
===================================================
*** PAGE 1: test.html ***

<html>
<form name=form1 method=post action=test2.html>
Name: <input type=text name=vname>
<br><br>Email: <input type=text name=email>
<br><input type=submit value=GO>
</form>
</html>



*** PAGE 2: test2.html ***

<html>

<b>Form results:</b><blockquote>

<script language=VBScript>

vname = document.form(&quot;form1&quot;).vname.value
email = document.form(&quot;form1&quot;).email.value


document.write(&quot;<br>Visitor Name: &quot;+vname)
document.write(&quot;<br>Email: &quot;+email)
document.write(&quot;<br><br>End Results</blockquote>&quot;)

</script>
</html>
===================================================

Everthing works in the test2.html page UP TO the point where I need to gather the form values from the first test.html form page.....
 
from u'r code it seems that u want to submit the information from page1 to page 2 and wants the data to accessed at client in page2.

Then u should either use hidden variables for it or can directly get the value in the VBScript as :

Using Hidden variables:

*** PAGE 2: test2.html ***

<html>

<b>Form results:</b><blockquote>

<script language=VBScript>

vname = document.form(&quot;form1&quot;).vname.value
email = document.form(&quot;form1&quot;).email.value


document.write(&quot;<br>Visitor Name: &quot;+vname)
document.write(&quot;<br>Email: &quot;+email)
document.write(&quot;<br><br>End Results</blockquote>&quot;)

</script>
<input type=&quot;hidden&quot; value=<%=request.form(&quot;vname&quot;)%> id=vname>
<input type=&quot;hidden&quot; value=<%=request.form(&quot;email&quot;)%> id=email>
</html>
===================================================

With Out using Hidden variables:


*** PAGE 2: test2.html ***

<html>

<b>Form results:</b><blockquote>

<script language=VBScript>

vname = <%response.write(request.form(&quot;vname&quot;)%>
email = <%response.write(request.form(&quot;email&quot;)%>

document.write(&quot;<br>Visitor Name: &quot;+vname)
document.write(&quot;<br>Email: &quot;+email)
document.write(&quot;<br><br>End Results</blockquote>&quot;)

</script>
<input type=&quot;hidden&quot; value=<%=request.form(&quot;vname&quot;)%> id=vname>
<input type=&quot;hidden&quot; value=<%=request.form(&quot;email&quot;)%> id=email>
</html>
===================================================


 
I think you're forgetting that this is CLIENT side. The Request object doesn't work and the &quot;document.form(&quot;form1&quot;).vname.value&quot; method gives me errors....

Any other ideas?
(THANKS btw [wink])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top