Discussion Locked

Basic HTML

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have no experience in HTML and am a newbie VBscripter. I have been given the task of creating a way to run VBscripts from a web page. The page needs to obtain input from the user and run a compilation of scripts according to which checkboxes are checked and/or info typed in.
I've got the basic page format down(checkboxes, backgrounds, text fields, etc.)and scripts written, but I can't figure out how to integrate the info from the page into the scripts (User types name into a text field and the script creates a folder). I also can't keep the scripts from running until the Submit button is pressed at the bottom of the page. I am expected to figure this out quickly, but I'm not that smart.

5 replies

by andrew

I'm sure you're plenty smart, but here are some tips that may help:

Your script probably runs because it's not in a sub or function:

The following will show 'Hello' as soon as the page loads:

The following will only show 'Hello' when the sub 'Test' is called:

You can access the values of elements by refering to their ID's. The following example displays what ever is in the text box.

This also demonstrates hooking the button click event to a method call. If you're actually submitting the form, you can call a function just before like this:

by wjlarue

Andrew has already given a pretty good answer but I like to add a few things. You can also link a document object to an event as demonstrated in the following code sample:

<script language="VBScript">
Sub cmdButton1_onClick()
msgbox("Just repeating what's in the box '" & Document.all("txtSample1").value & "'")
End Sub
</script>

<form action="" name="MyForm" id="MyForm">
<input type="text" name="txtSample1" id="txtSample1" size="50">
<input type="button" name="cmdButton1" id="cmdButton1" value="Button 1">
</form>

I would like to add that there is server and client side scripting. For server side scripting I like to send the form submit to an ASP page that has nothing but vbscript that executes on the server then redirects to another HTML page. All sample so far show just client side and it does sound like your looking for client side scripting help. But you also mention creating folders, which would require the FileSystemObject(FSO). Now if you?re looking to use FSO on the client machine - you have a lot of hurdle jumping and boulder dodging to do. There are several settings (and possible downloads) that need to be set on the client browser and machine to allow for this type of access. It?s a big security risk.

If you want more information just e-mail me I can point you to a couple resources. Good luck.

This discussion is closed to new replies.