Jump to content
Sign in to follow this  

Detect Submit click

Recommended Posts


I have an IE form for patients to request medication refills on-line. The problem is that after submitting the form, the patient doesn’t get a list of medications s/he requested.

I tried with _IEHeadInsertEventScript to call a function that reads the form’s text boxes, but all I could get is a message (“alert”) about leaving the page. I did not find any documentation to call a function or even get a msgbox that would call the function when clicked.

This is my code:

#include <IE.au3>
#include <Array.au3>
Local $avTheDrugs[8]
$oIE = _IEAttach ("Order Refill Request Form: Pharmacy Services, University Hospital")
$oForm = _IEFormGetObjByName ($oIE, 'Refill_Request_Form')

_IEHeadInsertEventScript ($oIE, "window", "onbeforeunload", _
"alert('Example warning follows...');return 'Pending changes may be lost';")

Func GetDrugName()
$oDrug1 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_1")
_ArrayInsert($avTheDrugs,0,_IEFormElementGetValue ($oDrug1))
$oDrug2 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_2")
_ArrayInsert($avTheDrugs,1,_IEFormElementGetValue ($oDrug2))
$oDrug3 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_3")
_ArrayInsert($avTheDrugs,2,_IEFormElementGetValue ($oDrug3))
$oDrug4 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_4")
_ArrayInsert($avTheDrugs,3,_IEFormElementGetValue ($oDrug4))
$oDrug5 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_5")
_ArrayInsert($avTheDrugs,4,_IEFormElementGetValue ($oDrug5))
$oDrug6 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_6")
_ArrayInsert($avTheDrugs,5,_IEFormElementGetValue ($oDrug6))
$oDrug7 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_7")
_ArrayInsert($avTheDrugs,7,_IEFormElementGetValue ($oDrug7))
$oDrug8 = _IEFormElementGetObjByName ($oForm, "rx_name_strength_8")
_ArrayInsert($avTheDrugs,8,_IEFormElementGetValue ($oDrug8))
;Remove blanks
For $n = UBound($avTheDrugs) - 1 To 0 Step -1
If StringStripWS($avTheDrugs[$n], 8) = "" Then
_ArrayDelete($avTheDrugs, $n)
_ArrayDisplay($avTheDrugs,"The drugs")

Thanks for your help.

Share this post

Link to post
Share on other sites

You may get some pointers from this:


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

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