Jump to content

How to fill a textarea on a webpage


 Share

Recommended Posts

Hi all,

I have some problems filling with text a TEXTAREA on a webpage.

I attached the html file, maybe somebody can help me.

I tried with this code but nothing happens:

$oForm = _IEFormGetObjByName ($oIE, "TEXTAREA")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, "bla bla bla bla")

I have to fill the "Comment" area

please help! :)

test.html

Edited by superbosu
Link to comment
Share on other sites

Not much to go on for symptoms. Add _IEErrorHandlerRegister() near the top of your script and run it in SciTE to see the messages in the console pane. Is there really a form by that name in your html?

:)

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

Not much to go on for symptoms. Add _IEErrorHandlerRegister() near the top of your script and run it in SciTE to see the messages in the console pane. Is there really a form by that name in your html?

:)

Hi PsaltyDS and tnx for the reply.. i'm new with autoit

there is no form with that name in my html but there is a textarea with a the ID sys_tasklog

is there a way to fill the text area using the id?

this is the html code of the textarea:

<td align="left" valign="top" width="139" class="tabline1" colspan="1">Comment</td><td align="left" valign="top" width="0" class="tabline1" colspan="3"><TEXTAREA id="sys_tasklog" NAME="sys_tasklog" ROWS="4" COLS="130" ></TEXTAREA><script LANGUAGE="Javascript" TYPE="text/javascript">

var input_ITALY_HD_CALL_EDIT_sys_tasklog = new rtcCreateInput( document.ITALY_HD_CALL_EDIT.sys_tasklog, RTC_TEXT_INPUT, true );

ITALY_HD_CALL_EDIT_Inputs[ ITALY_HD_CALL_EDIT_Inputs.length ] = input_ITALY_HD_CALL_EDIT_sys_tasklog;

</SCRIPT></td>

what is the correct way to fill the text area? maybe using $oForm = _IEGetObjById($oIE, "sys_tasklog") ?

Link to comment
Share on other sites

Look for the FORM tag, and use the correct name of the form with _IEFormGetObjByName($oIE, "Your_Form_Name_Here") to get $oForm. Then the rest should work:

#include <IE.au3>

_IEErrorHandlerRegister()
$sURL = "http://your.url.here"
$oIE = _IECreate($sURL)

; ...

$oForm = _IEFormGetObjByName ($oIE, "Your_Form_Name_Here")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, "bla bla bla bla")

:)

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

HI Shi, I don't find this function on help http://www.autoitscript.com/autoit3/docs/libfunctions.htm

how can I use this on my example?

for PsaltyDS ... I tried the code but nothing happens....

this is the form name :

<FORM action="genericcall.asp" METHOD="POST" NAME="ITALY_HD_CALL_EDIT">

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, "bla bla bla bla")
_IEFormElementSetValue ($oText, "bla bla bla bla")

plese do a test with the file attached

Edited by superbosu
Link to comment
Share on other sites

for PsaltyDS ... I tried the code but nothing happens....

this is the form name :

<FORM action="genericcall.asp" METHOD="POST" NAME="ITALY_HD_CALL_EDIT">

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, "bla bla bla bla")
_IEFormElementSetValue ($oText, "bla bla bla bla")
You STILL haven't tried it with the error handler and reported the very explicit, helpful, and detailed errors it reported...

:)

plese do a test with the file attached

Not jolly likely. I don't know you. But you can do a test with the error handler, as I said earlier, and post the errors you get in the console pane of SciTE.

;)

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

HI Shi, I don't find this function on help http://www.autoitscript.com/autoit3/docs/libfunctions.htm

how can I use this on my example?

for PsaltyDS ... I tried the code but nothing happens....

this is the form name :

<FORM action="genericcall.asp" METHOD="POST" NAME="ITALY_HD_CALL_EDIT">

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, "bla bla bla bla")
_IEFormElementSetValue ($oText, "bla bla bla bla")

plese do a test with the file attached

Link to comment
Share on other sites

Hi PsaltyDS,

I don't know how to use _IEErrorHandlerRegister() and see the errors.

but I did many tests and finaly it works in that way:

$chiusura = FileRead("D:\repe\chiusura.txt")
$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oText = _IEFormElementGetObjByName ($oForm, "sys_tasklog")
_IEFormElementSetValue ($oText, $chiusura)
_IEFormSubmit ($oForm)
_IEAction ($oIE, "back")
_IELoadWait ($oIE)

$oForm = _IEFormGetObjByName ($oIE, "ITALY_HD_CALL_EDIT")
$oSubmit = _IEGetObjByName ($oIE, "whocares")
_IEAction ($oSubmit, "click")

so when i use _IEFormSubmit ($oForm) and go back with _IEAction ($oIE, "back") on the TEXTAREA I can see the txt :)

donno why but it works...

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