Jump to content
Sign in to follow this  

Having trouble getting the object name from a form created in java script

Recommended Posts


Okay, let me re-word this question:

In the form I am trying to manipulate, a Form Element has the following characteristics:

- Index = 10

- tag = TEXTAREA

- Name = CTL_6_4

- ID = CTL_6_4

I have tried:

$o_Mail = _IEFormGetObjByName ($o_IE, "form1")
$o_Body = _IEFormElementGetObjByName ($o_Mail, "ctl_6_4")
_IEFormElementSetValue ($o_Body, $Body)

But to no avail. In the same form, I use the following code to sucessfully set the value of a form element (type=input) with the following code:

$o_Mail = _IEFormGetObjByName ($o_IE, "form1")
$o_Subject = _IEFormElementGetObjByName ($o_Mail, "_ctl6:_ctl4:subject")
_IEFormElementSetValue ($o_Subject, $Subject)

So I guess what I am asking is how to set the value of a TEXTAREA form element .

Any help would be greatly appreciated.....

Edited by LovinItAll

Share this post

Link to post
Share on other sites

Oh yeah, obviously the variables have been assigned earlier in the script :o

Share this post

Link to post
Share on other sites

Edit: OK, this example as originally posted created some confusion. I've split it up and added some comments to make it more clear.


Here is a self-contained example of setting the value of a TextArea:

; The first section of this script:
;    1) creates a new, empty browser window 
;    2) creates a form with a text area for testing (using $sBody)
#include <ie.au3>

$oIE = _IECreate()
$sBody = "<form id='form1'><textarea cols=20 rows=8 id='tarea'></textarea></form>"

; This section of the script demonstrates how to set the value of an existing TextArea.  
; You'll need to modify it to match the structure of your HTML, but it works with the 
; HTML loaded above.

; get a reference to the form
$oForm = _IEFormGetObjByName($oIE,"form1") 

; get a reference to the textarea element
$oTarea = _IEFormElementGetObjByName($oForm,"tarea") 

; write text to the textarea element
 _IEFormElementSetValue($oTarea,"Text In a TextArea")


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

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