Jump to content

Get Status Of Form Element


Recommended Posts

Hi everybody.

I'm trying to read values from a search result page. When all values have been read the script should navigate to the next result page until it runs out of results. At this point the "next" button would be disabled.

The "next" button is an form element of type submit.

I tried the following code:

Func _IE_formclick($ObjIE, $_find, $_form = 0)
   For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1
      If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then
         $ObjIE.document.forms ($_form) .elements ($i) .click()
         Return 1
      EndIf
    Next
  Return -1
EndFunc

Unfortunately the script happily clicks the disabled button and returns "1". If someone could tell me how I can check if the button is disabled to exit my loop I would be grateful :)

Note: I can't use _IEFormSubmit since there are two submit buttons (prev. and next).

Thanks, Ebenezer

Link to comment
Share on other sites

Hi everybody.

I'm trying to read values from a search result page. When all values have been read the script should navigate to the next result page until it runs out of results. At this point the "next" button would be disabled.

The "next" button is an form element of type submit.

I tried the following code:

Func _IE_formclick($ObjIE, $_find, $_form = 0)
   For $i = 1 To $ObjIE.document.forms ($_form) .elements () .length - 1
      If StringInStr($ObjIE.document.forms ($_form) .elements ($i) .outerHTML, $_find) > 0 Then
         $ObjIE.document.forms ($_form) .elements ($i) .click()
         Return 1
      EndIf
    Next
  Return -1
EndFunc

Unfortunately the script happily clicks the disabled button and returns "1". If someone could tell me how I can check if the button is disabled to exit my loop I would be grateful :)

Note: I can't use _IEFormSubmit since there are two submit buttons (prev. and next).

Thanks, Ebenezer

There is a .disabled boolean property you can check on the input element. It will be True if disabled, False by default.

Dale

Edit: typo

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

So the syntax would be

If $ObjIE.document.forms($_form).elements($i).disabled = "True" Then
    MsgBox(0, "", "Button is disabled")
EndIf

right? Sorry, I'm rather bad at this html/objects reference stuff :">

right, but it may be easier to do something like:

If Not $ObjIE.document.forms($_form).elements($i).disabled Then
;your click next page code
EndIf

***edit*** forgot my

Edited by cameronsdad
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...