Jump to content
Sign in to follow this  

Selection Drop Down List

Recommended Posts


I have the following code in HTML and as you can see there is fired on changes and I couldn't make it to select the third option:

<select name="ctl00$ContentPlaceHolder1$ddlReportType" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$ddlReportType\',\'\')', 0)" id="ctl00_ContentPlaceHolder1_ddlReportType">
    <option selected="selected" value="KeyUserSummary">Key User Summary</option>
    <option value="SummaryResultAnswer">Summary Result With Answers</option>
    <option value="SummaryResultNoAnswer">Summary Result Without Answers</option>


and this is the autoit script:

$oIE = _IECreate ("http://localhost/tvi/")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "form1") ;The form id changed
$o_login = _IEFormElementGetObjByName ($o_form, "tbUsername")
$o_password = _IEFormElementGetObjByName ($o_form, "tbPassword")
$o_signin = _IEFormElementGetObjByName ($o_form, "btnLogin") ;the button name changed

$username = "***"
$password = "XXXX"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

_IENavigate ($oIE, "http://localhost/tvi/Admin/SurveyReportByIndividual.aspx")

$oForm = _IEFormGetCollection($oIE, 0)
$colElem  = _IEFormElementGetCollection($oForm)

;$iElemCnt = @extended
;$sMsg = "Element values:" & @CRLF
;$i = 0
;For $oElem In $colElem
;    $sMsg &= $i & ":  " & _IEFormElementGetValue($oElem) & @CRLF
;    $i += 1
;MsgBox(64, $iElemCnt & " Results", $sMsg)

$oIE = _IE_Example ("http://localhost/tvi/Admin/SurveyReportByIndividual.aspx")
$oForm = _IEFormGetCollection($oIE, 0)

$o_ReportType = _IEFormGetObjByName ($oForm, "ctl00$ContentPlaceHolder1$ddlReportType") ;The form id changed

$test = _IEFormElementOptionselect($o_ReportType, "Summary Result Without Answer", 1, "byText");
Edited by DCAlliances

Share this post

Link to post
Share on other sites


At this line of your code:

$o_ReportType = _IEFormGetObjByName ($oForm, "ctl00$ContentPlaceHolder1$ddlReportType") ;The form id changed

I see there are dollar signs. Are they suppose to be variables? If so then it should be like this:

$o_ReportType = _IEFormGetObjByName ($oForm, "ctl00" & $ContentPlaceHolder1 & $ddlReportType) ;The form id changed


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post

Link to post
Share on other sites

Hi jfcby

Actually I've managed to make it works. That control name is name of the dropdownlist which I suppose to use the ID instead.

I just found that I can use the SciTe tools so I can sort of debugging which is cool!


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this