Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2007, 03:57 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
Assigning value from variable cyberddindia Classic ASP Basics 3 November 7th, 2006 11:57 AM
Assigning a value to a Radio Button List acorbo ASP.NET 1.0 and 1.1 Professional 3 June 27th, 2004 12:39 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM
Assigning a @@ROWCOUNT to a variable ioates SQL Server DTS 2 January 9th, 2004 04:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.