...

View Full Version : vbscript and html forms..pain in the @$$



velious
03-08-2004, 05:02 PM
I have a few questions here:

1) in the form, does the name of the button have to have the ()'s or only when its in the vb script?

2) do i need the <form> tags? with the <input> tags can i just get rid of them and use the input tags instead?

3) and i dont understand how to make the vb code look at the html values that the user inputs and this is making me real frustrated, so if anyone can please help me, that would be great.



<html>
<!-- user inputs a value,and the box returns the same value that the user inputs -->

<head>

<script language="vbs">

sub bvalue_onclick()


end sub

</script>



</head>

<body bgcolor="fafad2">

<!-- form -->
<form name="value">
Input any value: <input type="text" name="ivalue">
<input type="button" name="bvalue" value="click me">
</form>

<!-- end of form -->

</body>
</html>

sad69
03-09-2004, 12:38 AM
Personally, I would use Javascript over VBScript because it makes more sense, and browsers other than Internet Explorer support it. (VBScript is a Microsoft product, thus only Internet Explorer supports it).

But if you really want to know how to make your code work:


<html>
<!-- user inputs a value,and the box returns the same value that the user inputs -->

<head>

<script language="vbs">

sub bvalue_onclick()
msgbox theForm.theInput.value
end sub

</script>



</head>

<body bgcolor="fafad2">

<!-- form -->
<form name="theForm">
Input any value: <input type="text" name="theInput">
<input type="button" name="bvalue" value="click me">
</form>

<!-- end of form -->

</body>
</html>


For more form stuff with VBScript, check out:
http://authors.aspalliance.com/glenncook/vbscript.asp

If you'd like to learn a little Javascript, check out:
http://javascript.about.com/library/scripts/blformvalidate.htm

You do need the <form> tag if you want to be able to submit the inputs on your form somewhere, such as to an ASP, PHP, JSP, Servlet, CGI, or something else to do some logic stuff, or even to send the inputs to an email address.

If you're not going to do anything with your inputs outside of this page, then no, you don't need the form tags. But it still doesn't hurt to have them in.

Hope that clears some stuff up. Post back if you're having more troubles,
Sadiq.

velious
03-09-2004, 04:49 PM
Thanks, I'll be sure to ask if i have any more questions.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum