Jump to content

Set Focus in IE Form Field


Recommended Posts

I am trying to write a simple script that will load a web page and set the value in a form. I have been able to do this using the _IEFormElementSetValue. The problem is that this form uses javascript to perform some needed validating when you tab out of this form field. The Set value function I used does not actually set focus to the field so sending a {tab} does nothing. How can I set focus to a form object I have?

Thank you,

Steve

Link to comment
Share on other sites

Look at _IEAction

Dale

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

Then it may not be the focus event that is important to the Javascript. You'll need to do some trial and error or get into the script to see what event is triggering the validation.

Note that you may need to use the .fireEvent method of the object to cause the necessary event to be fired.

dale

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

Then it may not be the focus event that is important to the Javascript. You'll need to do some trial and error or get into the script to see what event is triggering the validation.

Note that you may need to use the .fireEvent method of the object to cause the necessary event to be fired.

dale

It is the Tab event out of the field. In order to fire that event in IE, the fields has to have focus. The only thing I have been able to get to work is to send a mouseclick to a specific point on the field. And then send a tab. It does not always work because I have a banner at the top that changes and pushes the form up and down.
Link to comment
Share on other sites

There is no such thing as a "tab event".

_IEFormElementSetValue fires two events for you like this:

$o_object.fireEvent("onchange")

$o_object.fireEvent("onclick")

You might also need onfocus, onfocusin, onfocusout -- it all depends on what the script is looking for.

See the links in my sig for MSDN docs on events.

Dale

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

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