I'm trying to prepopulate some text in the comment box on a member's profile page. I tried to use tinyMCE.activeEditor.setContent() in the custom code section, but it wasn't working.

Is there some other way I can access the editor or at least access the textarea with javascript to add some text?

Thanks,

Angelo

Views: 107

Reply to This

Replies to This Discussion

There is a code at JenSocial to place a notification box on members profile pages, but I'm not sure if it's one of her premium tips, or basic Ning tips.

Cool, we'll definitely check it out. Maybe this can help us achieve our end game instead of what we have been trying to do. (I'm with the same network as Angelo)

We were able to add some text to the comment box with:

document.getElementById("xg_profiles_chatterwall_post_comment").value = "some text";

Unfortunately, that puts the text directly in the rich text editor (not the HTML) function of the tinyMCE editor, so if I put (character encoded) "<a href="link">link</a>" in the "some text" it displays in the comment as "<a href="link">link</a>" instead of as "link." Not sure how to get around this :-/

Figured it out (noob javascript mistake I think).

I believe the custom code box that we use is fired before all the default ning javascript, so the tinymce functions were being called before tinymce was loaded. This is how I solved the problem:

setTimeout(function(){
tinymce.activeEditor.setContent("some text");
}, 1000);

Setting the delay lets the tinymce script fire first, giving access to the tinymce object and all of the associated functions :-D

RSS

Latest Activity

John Bizley replied to Donna Mac's discussion '3.0 Video - can someone explain?'
"They will be adding the function for members to add their youtube channels, it does say also that…"
16 minutes ago
John Bizley replied to Alex's discussion 'More styling in the Design Studio'
"Hmm this is all very nice but wouldn't any updates on the design studio's issues …"
26 minutes ago
Alex from Bougex.com replied to Alex from Bougex.com's discussion 'Leaving Ning... to SocialEngine. Happy... huuummmm.... don't know yet !!!'
"We are still optimizing code.... #$%?&*( Really guys, if one day you want to leave ning...…"
1 hour ago
Alex replied to Alex's discussion 'More styling in the Design Studio'
"Thanks JFarrow!"
1 hour ago
Alex replied to Alex's discussion 'More styling in the Design Studio'
"We don't plan on being like Skysa."
1 hour ago

NC for Hire
JFarrow replied to Alex's discussion 'More styling in the Design Studio'
"nice work guys!"
1 hour ago
Donna Mac replied to Donna Mac's discussion '3.0 Video - can someone explain?'
"How weird is that?   I don't quite understand that concept if only I can post what is on…"
2 hours ago
Kos replied to Donna Mac's discussion '3.0 Video - can someone explain?'
"That's my understanding but let's see if others have an approach on how they're…"
2 hours ago

© 2013   Created by Ning.

Badges  |  Report an Issue  |  Terms of Service