Dynamic tinymce id

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
babusar
Posts: 4
Joined: Wed Dec 07, 2011 2:37 pm
Contact:

Dynamic tinymce id

Post by babusar » Wed Dec 07, 2011 2:56 pm

im having problem using javascript dom defined on forum to enter text into tinymce textarea . my text area id is dynamic so its not possible to pull content into it. here is javascript dom im using with complete macro below
URL GOTO=javascript:void(tinyMCE.editors[dynamic id].setContent('{{!COL2}}'));

Code: Select all

VERSION BUILD=7300701 RECORDER=FX
TAB T=1
URL GOTO=javascript:void(tinyMCE.editors[dynamic id].setContent('{{!COL2}}'));
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:editor ATTR=ID:u* CONTENT={{!COL3}}


Last edited by babusar on Sat Dec 10, 2011 2:16 pm, edited 1 time in total.
babusar
Posts: 4
Joined: Wed Dec 07, 2011 2:37 pm
Contact:

Re: Dynamic tinymce id

Post by babusar » Thu Dec 08, 2011 2:53 pm

:( no response ? will appreciate if anyone would like to help
willjohnathan
Posts: 34
Joined: Thu Dec 01, 2011 9:17 pm

Re: Dynamic tinymce id

Post by willjohnathan » Thu Dec 08, 2011 6:17 pm

I am kind of new to IMACROS, but have you tried something like this

Code: Select all

'get textarea html tag containing dynamic id
TAG POS=1 TYPE=TEXTAREA ATTR=ID:* EXTRACT=HTM
'use javascript regex to find id and set to var1
SET !VAR1 EVAL("var x='{{!EXTRACT}}'; var y = x.split(' '); var j = x.length; var i = 0; var s = 'id='; for(i;i<j;i++){if(y[i].indexOf(s) != -1){var myId = y[i].replace('id=', ''); myId = myId.replace(/\"/g, \"\"); i=j; }} myId;")
'var1 should equal id
URL GOTO=javascript:void(tinyMCE.editors['{{!VAR1}}'].setContent('!COL2}}'));
you might need to tweak it a little bit especially if the id is followed by the closing tag, but I think this concept should work for ie9 at least.
willjohnathan
Posts: 34
Joined: Thu Dec 01, 2011 9:17 pm

Re: Dynamic tinymce id

Post by willjohnathan » Thu Dec 08, 2011 7:00 pm

Also, if the textarea already has data you might want to put this line of code before the other code I posted because it seems IMACROS has difficulty with certain types of data in these types of textareas

Code: Select all

TAG POS=1 TYPE=TEXTAREA ATTR=ID:* CONTENT=
Of coarse if this isn't the only textarea on the page, then you might need to reference it by a class attribute or different position number or something.
babusar
Posts: 4
Joined: Wed Dec 07, 2011 2:37 pm
Contact:

Re: Dynamic tinymce id

Post by babusar » Sat Dec 10, 2011 10:58 am

Thnx it worked ! :)
topbgt
Posts: 3
Joined: Sat Dec 10, 2011 11:58 am

Re: Dynamic tinymce id

Post by topbgt » Sat Dec 10, 2011 12:13 pm

thanks willjohnathan :D
I found what I was looking here
regards
Post Reply