I have a custom template called "edittask" in which I got the WYSIWYG editor using this article.
Using that method the editor is inserted using {vb:raw messagearea} which I have to register in my php file as well as including functions_editor.php
I have created a variable called $edittask_desc which contains the old message which has been created previously using a different form (which also has a WYSIWYG editor).
What I can't work out is how to set the textarea value.
My template is below:
Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
<script type="text/javascript" src="clientscript/vbulletin-editor.js?v={vb:raw vboptions.simpleversion}"></script>
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}vbulletin-formcontrols.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}editor.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}bbcode.css" />
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<div class="task_controls"><div class="task_control_left"><h2>User Panel</h2></div><div class="task_control_right"></div></div>
<h2 class="blockhead">Create New Task</h2>
<div class="blockbody">
<div class="wysiwyg_block">
<div class="blockbody formcontrols">
<div class="blockrow">
<form class="vbform block" action="edittask.php" method="post" name="vbform" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(0,0)" ><br />
Name: <br /><input type="text" name="taskname" class="primary textbox full" value="{vb:raw edittask_name}" /><br /><br />
Type: <br /><select class="primary" name="tasktype"><option value="0">Select Type</option>{vb:raw type_tasks_options}</select><br /><br />
Description:<br />
{vb:raw messagearea}
<br />
<fieldset><legend>Assign Task: (optional)</legend>
Assign to User: <br />
<select name="taskuser" class="primary" cols="100"><option>none</option>{vb:raw task_user_options} </select><br /><br />
Due Date: <br /><input id="datepicker" class="primary textbox full" type="text" name="taskduedate" size="20" READONLY value="{vb:raw edittask_duedate}"/></fieldset>
</div>
</div>
</div>
<input type='hidden' name='taskid' value='{vb:raw edittask_id}'>
<input type='hidden' name='s' value='{vb:raw session.sessionhash}' />
<input type='hidden' name='securitytoken' value='{vb:raw bbuserinfo.securitytoken}' />
<div class="blockfoot actionbuttons">
<div class="group">
<input class="button" type="submit" value="Submit" />
</div></div>
</form>
</div>
<div style="width:100%;text-align:center;padding:10px;"><span class="copyright">Traction Wars Task Manager {vb:raw taskmanagerversion}</span></div>
{vb:raw footer}
</body>
</html>