Jump to content

Cannot Submit IE Form


Go to solution Solved by Danp2,

Recommended Posts

Hi I am trying to submit an IE Form:

<FORM encType=multipart/form-data method=post name=menuForm action=/nac-cp/default.html><TABLE>
<TBODY>
<TR>
<TD>Inspect:</TD>
<TD><INPUT onkeydown="if (event.keyCode == 13) {do_menu_form_submit('quickSearch_searchFieldId_');return false;};" title="<accessNode>:<rackId>-<shelfId>-<slotId>-[iMA#/BOND#]<portId> / <label> / <Id> / LABEL=<portlabel> / LBL=<portlabel> / CLABEL=<customerlabel> / CLBL=<customerlabel> / INSP=<Id> / INSPECTION=<Id>" value="BM0LCPLB:1-1-6-36  " type=text name=quickSearch_searchFieldId_> <INPUT type=hidden name=EventSource> <INPUT type=hidden name=stack> <INPUT type=hidden name=currentPosition> <INPUT value=81BF3F3055F23467DA83BE94A943C651.nwanalyser-nac-cp-jboss-slave-1 type=hidden name=JSESSIONID> </TD></TR></TBODY></TABLE></FORM>

The blow code does not work for me. There is no button for this form. From what I understand "onkeydown="if (event.keyCode == 13)" is the enter button. Does anyone know how I could gracefully send 'enter' to this without Winactivate or some such?

$na = _IEAttach("myurl.html", "url")
      Local $oForm = _IEFormGetObjByName($na, "menuForm")

      Local $oText = _IEFormElementGetObjByName($oForm, "quickSearch_searchFieldId_")
      _IEFormElementSetValue($oText, "Somedata")
    _IEAction($oForm, "$oForm")
Link to comment
Share on other sites

I added below in

$na.Document.parentWindow.execScript("key = document.createEventObject(); key.keyCode = #{key}")
$na.Document.parentWindow.execScript("document.getElementById('#{element_id}').fireEvent('onkeydown', key)")

and

$oText.fire_keydown_on($oForm, 13)

But im still scratching my head.

Any suggestions how I can send 'enter' or a cariage return?

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

×
×
  • Create New...