Jump to content

Drop Down menu label


Recommended Posts

I m a newbee.

plz. help me out..

a form dropdown menu source code is like :-

<option value="658">NYM219(214 Broadway)</option>

<option value="174">NYM234(270 Park Avenue)</option>

.....................

I have to get the texts/labels i.e. NYM219(214 Broadway) or NYM234(270 Park Avenue) or..........................

I hav selected the options in dropdownmenu as

$oIE = _IECreate ("XYZ")

$oForm = _IEFormGetObjByName ($oIE, "form1")

$oText = _IEFormElementGetObjByName($oForm, "company")

_IEFormElementOptionselect ($oText,4, 1,"byIndex")

MsgBox (0,"XYZ", _IEFormElementGetValue($oText))

but this gives the value of the option i.e. 658 or 174 or ....................

Plz. dont laugh if its a stupid problem.

Edited by Lokeshverma
Link to comment
Share on other sites

Hm, not sure about this one, as i never used it... but by looking at it with _IEFormElementGetValue you get exactlly what you wanted, the value of the option, in this case 658 or 174.

By looking at the source of the include IE.au3 i could not find another solution already implemented (but surly Im wrong ;) ).

A work-around which might work (purly speculation) might be, to copy the _IEFormElementGetValue() function and edit that to capture the inner text of the element... maybe this works, insert it at the bottom of your script:

Func _IEFormElementGetText(ByRef $o_object)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IEFormElementGetValue", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
;
    If Not __IEIsObjType($o_object, "forminputelement") Then
        __IEErrorNotify("Error", "_IEFormElementGetValue", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
;
    SetError($_IEStatus_Success)
    Return $o_object.innerText;<=== changed to innerText
EndFunc

and replace this line in your code

MsgBox (0,"XYZ", _IEFormElementGetValue($oText))

with this

MsgBox (0,"XYZ", _IEFormElementGetText($oText))

maybe, just maybe :lmao:... or i'm completly on the wrong track :evil:...

Edited by Polyphem
This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Nice ;)... Yeah, i see, the function seems to refer to the <form> element and not the <option> element ... guess you'll have to combine the _IEFormElementGetText with a _IEFormElementGetValue function call.

Extract _IEFormElementGetValue and _IEFormElementGetText.

Split the resulting _IEFormElementGetText string with the value retrieved from _IEFormElementGetValue, something like that :lmao:...

This post will be edited again by Polyphem: Tomorrow, 11:55 AM
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...