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!

vbscript forms

Status
Not open for further replies.

dwcandco

Programmer
Aug 21, 2003
7
SI
I would like to know is it posible to make forms in vbscript for example more input box in one form.

Thank you for your help.
 
Yes - you need three files (from what I can tell

----file 1 fdialogbox.vbs
'information for alltogether.vbs also needs alltogether.wfs
Function DialogBox(L, T, H, W, Cancel, File)
Dim DFile

Set DFile = FileSystem.GetFile(File)

IEDbx.Left = L
IEDbx.Top = T
IEDbx.Height = H
IEDbx.Width = W
IEDbx.MenuBar = 0
IEDbx.ToolBar = 0
IEDbx.StatusBar = 0
IEDbx.navigate DFile
IEDbx.Visible = 1


Do While (IEDbx.Busy)
WScript.Sleep 200
Loop

On Error Resume Next

Do
WScript.Sleep 200
Loop While (IEDbx.Document.Script.ClickButton() = 0)

If IEDbx.Document.Script.ClickButton() = 3 Then
Cancel = True
End If

If Err <> 0 Then
WScript.Quit
End If

On Error GoTo 0

End Function

------- File 2 alltogether.vbs------
<?XML Version=&quot;1.0&quot; ?> 'Generates a script form

<?job error=&quot;true&quot; debug=&quot;true&quot;?>
<job id=&quot;VB Code&quot;>

<script language=&quot;VBScript&quot; src=&quot;FDialogBox.vbs&quot;>

<![CDATA[

Dim IEDbx, FileSystem, DbxFile, Cancel

Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
Set FileSystem = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set IEDbx = WScript.CreateObject(&quot;InternetExplorer.Application&quot;)

Cancel = False
DbxFile = &quot;AllTogether.htm&quot;

Call DialogBox(100, 60, 486, 383, Cancel, DbxFile)

If Cancel Then
IEDbx.Quit
Set IEDbx = Nothing
Wscript.Quit
End If

FirstName = IEDbx.Document.Dbx.fname.Value
LastName = IEDbx.Document.Dbx.lname.Value

Set DropDownDialog = IEDbx.Document.Dbx.Elements
Set DropDownItem = DropDownDialog (&quot;Department&quot;)

For Each Item in DropDownItem.Options
If Item.Selected Then
Depart = Item.Text
Exit For
End If
Next

Set DropDownDialog = Nothing
Set DropDownItem = Nothing

Set RadioButtonDialog = IEDbx.Document.Dbx.Elements(&quot;Comp&quot;)

For Each RadioButton in RadioButtonDialog
If RadioButton.Checked = True Then
Comp = RadioButton.Value
Exit For
End If
Next

Set RadioButtonDialog = Nothing

Set CheckBoxDialog = IEDbx.Document.Dbx.Elements(&quot;App&quot;)
List = &quot;&quot;
For Each CheckBox in CheckBoxDialog
If CheckBox.Checked = True Then
List = List & vbCrLf & CheckBox.Value
End IF
Next

Set CheckBoxDialog = Nothing

Results = &quot;You chose the following:&quot; & vbCrLf &_
FirstName & &quot; &quot; & LastName & vbCrLf &_
Depart & vbCrLf &_
Comp & vbCrLf &_
List

MsgBox Results

IEDbx.Quit
Set IEDbx = Nothing


]]>
</script>
</job>

-------file 3 alltogether.htm-----
<html>

<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html; charset=iso-8859-1&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage Express 2.0&quot;>
<title>TroubleShooter</title>
</head>

<body bgcolor=&quot;#D3D1CF&quot; scroll=&quot;no&quot;>
<script language=&quot;VBScript&quot;>
<!--

Dim Continue

Sub Window_OnLoad()
Continue = 0
End Sub

Sub button1_OnClick
Continue = 1
End Sub

Sub button2_OnClick
Continue = 3
End Sub

Public Function ClickButton
ClickButton = Continue
End Function

'-->
</script>

<form name=&quot;Dbx&quot;>
<p>Please type your first and last name:<br>
First name: <input type=&quot;text&quot; size=&quot;20&quot; name=&quot;fname&quot;> <br>
Last name: <input type=&quot;text&quot; size=&quot;20&quot; name=&quot;lname&quot;></p>
<p>Please select your department<br>
<select name=&quot;Department&quot; size=&quot;1&quot;>
<option>None of Your Business</option>
<option>Accounting</option>
<option>Administration</option>
<option>Sales</option>
<option>Warehouse</option>
<option>Customer Relations</option>
<option>Marketing</option>
</select></p>
<p>Please select you computer </p>
<div align=&quot;left&quot;><table border=&quot;0&quot; width=&quot;350&quot;>
<tr>
<td width=&quot;50%&quot;><input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Compaq Deskpro EN&quot;>Compaq Deskpro EN<br>
<input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Dell Dimension L&quot;>Dell Dimension L<br>
<input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Gateway Profile&quot;>Gateway Profile</td>
<td width=&quot;50%&quot;><input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Compaq Deskpro EXD&quot;>Compaq Deskpro EXD<br>
<input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Dell Dimension 4100&quot;>Dell Dimension 4100<br>
<input type=&quot;radio&quot; name=&quot;Comp&quot;
value=&quot;Gateway Profile&quot;>Gateway Performance</td>
</tr>
</table>
</div><p>Please select the applications installed on your
computer </p>
<div align=&quot;left&quot;><table border=&quot;0&quot; width=&quot;200&quot;>
<tr>
<td width=&quot;50%&quot;><input type=&quot;checkbox&quot; name=&quot;App&quot;
value=&quot;Word&quot;>Word<br>
<input type=&quot;checkbox&quot; name=&quot;App&quot; value=&quot;Excel&quot;>Excel<br>
<input type=&quot;checkbox&quot; name=&quot;App&quot; value=&quot;Access&quot;>Access</td>
<td width=&quot;50%&quot;><input type=&quot;checkbox&quot; name=&quot;App&quot;
value=&quot;PowerPoint&quot;>PowerPoint<br>
<input type=&quot;checkbox&quot; name=&quot;App&quot; value=&quot;Outlook&quot;>Outlook<br>
<input type=&quot;checkbox&quot; name=&quot;App&quot; value=&quot;FrontPage&quot;>FrontPage</td>
</tr>
</table>
</div><p><input type=&quot;button&quot; name=&quot;button1&quot; value=&quot; OK &quot;>
<input type=&quot;button&quot; name=&quot;button2&quot; value=&quot; Cancel &quot;></p>
</form>

<p>&nbsp;</p>
</body>
</html>

-------------end of files

try running this from the htm file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top