Hi all. I've got 2 textboxes in an HTA, and I'm trying to pull the
values of the textboxes into an array. Here's what I've got code
wise.
Code:
<HTML>
<HEAD>
<TITLE>Users Group Migration HTA</TITLE>
<HTA:APPLICATION
ID="MyApp"
APPLICATIONNAME="Template"
BORDER="thick"
BORDERSTYLE="complex"
CAPTION="yes"
CONTEXTMENU="no"
ICON="http://Your URL/your icon.ico"
INNERBORDER="yes"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
NAVIGABLE="no"
SCROLL="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="maximized"/>
</HEAD>
<SCRIPT Language="VBScript">
Sub Window_onLoad
window.resizeTo 640, 480
End Sub
' Cancel button
Sub ExitProgram
window.close()
End Sub
Dim arrUsers(1)
arrUsers(0) = User1.value
arrUsers(1) = User2.value
Function myBox(x)
myBox = arrusers(i)
End Function
'Let's use our function!
Sub btnComp_Click
Dim result
For i = 0 To 1
If i = 0 Then
result = myBox(i)
MsgBox (result)
ElseIf i = 1 Then
MsgBox "This is what comes next."
End If
Next
End Sub
</Script>
<body STYLE="font:10pt arial; color:white;
(background-color:Menu;
color:MenuText;
cursor:default;)">
<p align=left><b>Group Migration Tool</b></font></p>
<table>
<tr>
<col align="left"></col>
<col width="160"></col>
<col align="left"></col>
<th><b>New User ID.</b></th>
<th> </th>
<th><b>Template User ID.</b></th>
</tr>
<tr>
<td><input type="text" name="User1" size=20><p align=left></td>
<td> </td>
<td><input type="text" name="User2" size=20><p align=left></td>
</tr>
</table>
<tr>
<td><input type="button" value="Compare" name="btnComp"
onClick="btnComp_Click" STyle='background-color: ButtonFace;'
STyle='color:ButtonText;'></td>
<td><input id=runbutton type="button" value="Cancel"
onClick="ExitProgram" STyle='background-color: ButtonFace;'
STyle='color:ButtonText;'></td>
</tr>
<p>
<Span ID = "UserGroup1"</Span>
<Span ID = "UserGroup2"</Span>
</body>
</html>
When I try to run it, I immediately get an Object Required error on
User1 in line 34. I don't understand why. I've been googling, and
I've seen solutions that involve assigning variables to each textbox,
but I had thought that defining them in the array would take care of
that. Can someone show me where I'm going wrong? Thanks!