I have been searching for an answer to the problem I've
been having with a form. I have an HTML file that I load
via a VBScript that is being used to copy CDs to a network
drive. The user will enter the year and the CD number in
the form. Then VBScript creates a folder based on the
information entered and copies the CD to it.
The problem I'm having is that when the Submit button is
clicked the only way I could get the calling VBScript to
take over is to put a MsgBox in the HTML's script area. I
dont mind that except that I would like to have the dialog
box close automatically. I can't use the PopUp function
since IE's security complains. I tried using a For/Next
but that didn't help. What can I do to avoid the MsgBox.
Shown below are snippets from the HTML and VBS files.
Thanks for your help.
===================================================
HTML File (Form section):
===================================================
<form action="" onsubmit="vbscript: CopyDisk()"
method="POST" border="0" width="100%" id="MyForm"
name="MyForm">
<input type="hidden" name="bWaiting" value="TRUE">
<table border="0" width="100%"
<td width="60"> Enter the Year here: <input
type="text" name="Year" id="Year" maxlength="4" size="4"
onkeypress='validate(Me)'</td>
<br>
<td width="860">Enter the CD Number here:
<input type="text" name="CDInfo1" id="CDInfo1"
maxlength="8" size="8" onkeypress='validate(Me)'
===================================================
HTML File (VBS section):
===================================================
<SCRIPT language="VBScript">
Sub CopyDisk()
MyForm.bWaiting.value = "FALSE"
If Len( MyForm.Year.value ) > 0 AND Len(
MyForm.CDInfo1.value ) > 0 Then
MsgBox "Now copying the CD. Please wait for the ""Copy
completed...."" message before clicking OK below."
Else
ExitNow()
End If
End Sub
Sub ExitNow()
MyForm.bWaiting.value = "WAIT"
If MsgBox( "Are You Exiting the Input Window?",
(vbQuestion + vbYesNo), "Exit Information" ) = vbNo Then
MyForm.bWaiting.value = "TRUE"
Else
MyForm.bWaiting.value = "FALSE"
End If
End Sub
</SCRIPT>
===================================================
VBS File:
===================================================
Do While NOT (objExplorer.Busy)
Loop
strYear = objDocument.myForm.Year.value
strCDNo = objDocument.myForm.CDInfo1.value
objExplorer.Visible = 0
If Len( strYear ) = 0 OR Len( strCDNo ) = 0 Then
Do Until objDocument.myForm.bWaiting.value <> "WAIT"
wScript.Sleep 750
Loop
If objDocument.myForm.bWaiting.value = "FALSE" Then
Exit Do
ElseIf objDocument.myForm.bWaiting.value = "WAIT" Then
wScript.Sleep 500
objDocument.myForm.bWaiting.value = "TRUE"
End If
Else
On Error Resume Next
strTarget = CNST_RCV_FLDR & "CD" & strYear & "_" &
strCDNo
If NOT objF_Sys.FolderExists( strTarget ) Then
objF_Sys.CreateFolder strTarget
.......