View Full Version : Making a text editor appear with text inside
Dirtchamber
01-16-2009, 01:56 PM
Is there any way to "spawn" a text editor (i.e. the thing I'm using to type this message) with text already inside? So, for example, if I were asking people to upload images, I'd like to make it so the text editor spawns with some predefined profile text inside - stuff like "Name, Age etc.".
Is that possible?
Thanks much,
Dan
Lynne
01-16-2009, 02:30 PM
Do a search for the Thread Stencil mod. I think that will do what you want.
Dirtchamber
01-18-2009, 03:02 AM
Hey Lynne,
That's actually a really useful mod, and although I'll use it for other stuff, it doesn't do what I need in this instance. See, the thing is, I'm using the Ultimate Media Gallery, and it's in there that I'd like to spawn a text editor with text.
So: is there a manual way to do it? Like, perhaps I need to edit a PHP file or a template or something?
Any help appreciated,
Dan
Lynne
01-18-2009, 03:32 AM
I'm not familiar with that mod, but it sounds like you are just talking about a form (like this box is). If so, google "form html" and you should be see how to pre-populate form elements. (I think that is what you are trying to do?)
Dismounted
01-18-2009, 03:42 AM
The two most popular (text) elements, pre-populated:
<input type="text" name="something" length="15" value="Some Text" />
<textarea name="sometextarea" cols="60" rows="10">
Some Text Here
</textarea>
Dirtchamber
01-18-2009, 03:54 AM
I'm not familiar with that mod, but it sounds like you are just talking about a form (like this box is). If so, google "form html" and you should be see how to pre-populate form elements. (I think that is what you are trying to do?)
Ach! I'm terrible at explaining myself when it comes to this stuff. Perhaps I should just show you what I mean?
Basically, I want the 'Description' box here (http://www.eegra.com/forum/umg.php?c=1&do=usercp&act=upload&special=upl) to be pre-populated with text - namely, some basic stuff like "Name, Age etc.". So, I don't want to create a form per se, but populate an existing one (I guess?).
What I'm wondering is how I'd do that. And an idea of where I'd do it - i.e. in PHP, or in templates etc.
I apologise if I'm coming across a bit dense. I'm sort of just picking this stuff up as I go, and appreciate all your help.
Dan
Lynne
01-18-2009, 03:31 PM
Exactly what I was thinking. That Description box is a form element - a <textarea> as Hanson wrote above. So, you want to pre-populate the <textarea>. Hanson wrote the html to do that.
ragtek
01-18-2009, 03:34 PM
If it is a vb add-on which is using the construct_edit_toolbar function(and i think it is one), you'll have to search for the call of construct_edit_toolbar in the file and add the text you want to have into, as first parameter!
// ################################################## ###########################
/**
* Prepares the templates for a message editor
*
* @param string The text to be initially loaded into the editor
* @param boolean Is the initial text HTML (rather than plain text or bbcode)?
* @param mixed Forum ID of the forum into which we are posting. Special rules apply for values of 'privatemessage', 'usernote', 'calendar', 'announcement' and 'nonforum'
* @param boolean Allow smilies?
* @param boolean Parse smilies in the text of the message?
* @param boolean Allow attachments?
* @param string Editor type - either 'fe' for full editor or 'qr' for quick reply
* @param string Force the editor to use the specified value as its editorid, rather than making one up
*
* @return string Editor ID
*/
function construct_edit_toolbar($text = '', $ishtml = false, $forumid = 0, $allowsmilie = true, $parsesmilie = true, $can_attach = false, $editor_type = 'fe', $force_editorid = '')
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.