Jump to content

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>

</select>

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
;Next
;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
Link to comment
Share on other sites

DCAlliances,

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

jfcby

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 ****

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...