Jump to content

trying to extract DOM elements and reuse them


Recommended Posts

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

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

Edited by diikee
Link to comment
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
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...