Micro Focus QTP (UFT) Forums
How to change script for checkbox from Dropdown list - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to change script for checkbox from Dropdown list (/Thread-How-to-change-script-for-checkbox-from-Dropdown-list)



How to change script for checkbox from Dropdown list - mufiani - 01-13-2011

Hi,
I have a VB script for Dropdown list which select the values (yes or no) from the Data table. but the requirement changed the Dropdown list to Check box. for an example : yes I have to check , else uncheck.

I have attached my script for Dropdwon list. If anyone can help me how to change this script to check box for same scenario?
Code:
Set oWebList = Description.Create
oWebList ("name").value = "XYZ" & i
oWebList ("name").RegularExpression = false
oWebList ("html tag").value = "SELECT"
Disabled=Browser("Browser").Page("Drivers").WebList(oWebList).GetROProperty ("disabled")
If  Disabled = "0" Then
Browser("Browser").Page("Drivers").WebList(oWebList).Select Datatable.Value ("Order" & i, dtlocalSheet)      
End If

Scenario: every time I add new driver I will get this dropdown list for each drive, hence my script have a loop for adding each driver and selecting Dropdown list value for each driver.

I am using QTP 9.5


RE: How to change script for checkbox from Dropdown list - rajeshwar - 01-13-2011

Try implementing your logic around this

Code:
If Strcomp ("Yes",Datatable.Value ("Order" & i, dtlocalSheet),1) = 0   Then
        flag = "ON"
        Else
        flag = "OFF"
    End If

If Disabled = "0" Then
    Browser("..").Page("..").WebCheckBox("..").Set  flag
End If



RE: How to change script for checkbox from Dropdown list - mufiani - 01-13-2011

Thank You so much for help. It works fine.....