Sign in to follow this  
Followers 0
diikee

trying to extract DOM elements and reuse them

4 posts in this topic

<TD class=startsub>quality

<script>writeQuality();</SCRIPT>

<SELECT onchange=setQuality(this); name=quality>

<OPTION value=high>medium</OPTION>

<OPTION value=medium selected>high</OPTION>

<OPTION value=low>fine</OPTION>

<OPTION value=xlow>superfine</OPTION>

</SELECT>

</TD>

$oForm = _IEFormGetObjByName ($oIE, "myform")
$oInputs = _IETagNameGetCollection ($oIE, "[color="#000080"]select[/color]")
For $oInput In $oInputs
        $oQuery = _IEFormElementGetObjByName ($oInput, "OPTION")    
        MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery.value
        & " Type: " & $oInput.$oQuery.value.innerText)
Next

MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery.value

MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery^ ERROR

I want to get the options available for selection, save them to a variable and reuse them as a comparison point to whether my _IEFormElementOptionselect is working.

what am I doing wrong??

Share this post


Link to post
Share on other sites



<TD class=startsub>quality

<script>writeQuality();</SCRIPT>

<SELECT onchange=setQuality(this); name=quality>

<OPTION value=high>medium</OPTION>

<OPTION value=medium selected>high</OPTION>

<OPTION value=low>fine</OPTION>

<OPTION value=xlow>superfine</OPTION>

</SELECT>

</TD>

$oForm = _IEFormGetObjByName ($oIE, "myform")
$oInputs = _IETagNameGetCollection ($oIE, "[color="#000080"]select[/color]")
For $oInput In $oInputs
        $oQuery = _IEFormElementGetObjByName ($oInput, "OPTION")    
        MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery.value
        & " Type: " & $oInput.$oQuery.value.innerText)
Next

MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery.value

MsgBox(0, "Form Input Type", "Form: " & $oInput.$oQuery^ ERROR

I want to get the options available for selection, save them to a variable and reuse them as a comparison point to whether my _IEFormElementOptionselect is working.

what am I doing wrong??

Just use $oQuery.value -- not $oInput.$oQuery.value.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

$oInputs = _IETagNameGetCollection ($oIE, "select")

For $oInput In $oInputs

If ($oInput.name) = "quality" then

$opt = _IETagNameGetCollection($oInput, "OPTION")

For $op in $opt

MsgBox(0, "Selection Values", "Name: " & $oInput.name & " Type: " & $op.innerText)

Next

ExitLoop

EndIf

Next

I was able to get the values using method above

How do I save this values to an array so that I can use them as selection items??

Edited by diikee

Share this post


Link to post
Share on other sites

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

$oInputs = _IETagNameGetCollection ($oIE, "select")

For $oInput In $oInputs

If ($oInput.name) = "quality" then

$opt = _IETagNameGetCollection($oInput, "OPTION")

For $op in $opt

MsgBox(0, "Selection Values", "Name: " & $oInput.name & " Type: " & $op.innerText)

Next

ExitLoop

EndIf

Next

I was able to get the values using method above

How do I save this values to an array so that I can use them as selection items??

If what you want is .name and .innertext then you might do this:
Global $avOpt[1][2]

$oForm = _IEFormGetObjByName($oIE, "myform")
$oInputs = _IETagNameGetCollection($oIE, "select")

For $oInput In $oInputs
    If ($oInput.name) = "quality" Then
        $opt = _IETagNameGetCollection($oInput, "OPTION")
        ReDim $avOpt[@extended][2]
        $n = 0
        For $op In $opt
            $avOpt[$n][0] = $oInput.name
            $avOpt[$n][1] = $op.innerText
            $n += 1
        Next
        ExitLoop
    EndIf
Next

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0