Ideas - Predefined edit textarea text - 08MAR2004
I'm trying changes to my template's EditTemplate.jsp where I can define content and provide it for insertion into the edit page textarea from a drop-down widget and button. The options in the drop-down would be filled in from a special page with a line for the drop-down name and the page to include when the button is pushed: (Book BookEditTemplate, Organization OrgEditTemplate, Person PersonEditTemplate). I find myself typing the skeleton of pages like this all the time, and I always forget fields when I do it. The button would have to operate using JavaScript, and I am unsure at the moment how it could get access to the wiki pages' text . I hate calling this feature "templates", for obvious reasons. The starting scripts:
function fillin()
{
if( document.forms[0].fillins.value == "book" )
{
addFillin("__title__\\\\\n" + "by \\\\\n" + "[Amazon|]\n" + "\n" + "See more [Books]");
}
else if( document.forms[0].fillins.value == "biography" )
{
addFillin("__Name__\\\\\n" + "\n" + "See more [Biographies]");
}
else if( document.forms[0].fillins.value == "organization" )
{
addFillin("__Name__\\\\\n" + "\n" + "See more [Organizations]");
}
}
function addFillin(newText)
{
document.forms[0].text.value += newText;
}
And HTML:
<select name="fillins" >
<option>book</option>
<option>organization</option>
<option>biography</option>
<option selected="selected">none</option>
</select>
<input type="button" value="Insert fillin" onClick="fillin()"/>