Assigning variable value from a radio button
Ladies and Gents,
I'm brand new to this forum and have never posted before, so please bare with me.
I usually don't post questions on forums like this, only because I'm stubborn and like to figure things out for myself. However, I'm really stuck and can't seem to get around this problem.
What I'm doing is trying to pass the value of a radio button selection to a variable in VBScript. I have tried many different methods, all snippets taken from the web, to no avail.
Following is what I have. Any help would be greatly appreciated.
First, I have an html file with the following script in it:
'-----------------------------------
<SCRIPT LANGUAGE="VBScript">
Sub RunScript
OKClicked.Value = "OK"
If OUName(0).Checked Then
strOUName = OUName(0).Value
End If
If OUName(1).Checked Then
strOUName = OUName(1).Value
End If
If OUName = "" Then
Exit Sub
End If
End Sub
Sub CancelScript
OKClicked.Value = "Cancelled"
End Sub
</SCRIPT>
'------------------------------------
I put this script in the page to assign a value to the strOUName variable.
The html code for selecting the value on the same page looks like this:
'-------------------------------
<input type="radio" name="OUName" value="Workstations"> Workstation
<input type="radio" name="OUName" value="Laptops"> Laptop
'-------------------------------
Once the value of strOUName is acquired, I'm trying to pass it back to the .vbs file that opens this page with the following code entered into the .vbs file:
'--------------------------------------------
If strOUName = OUName(0).Value Then strOUAddTo = "Workstations"
ElseIf strOUName = OUName(1).Value Then strOUAddTo = "Laptops"
End If
'--------------------------------------------
What I'm trying to do here is have the script assign a value to the strOUAddTo variable based on the value of the strOUName variable from the html file.
For some reason this isn't working. Can anyone help please? In the big picture, this entire process is designed to add a new computer account to an active directory domain and move it in the OU that is defined by user input on the html page.
|