<script>
if ($('tmEditWysiwyg')) {
var switchEditor = function(editor, event) {
/*
* Notice the velocity string "${formname}" below, this
* should not be here
*/
var form = document.forms.${formname};
form.fire('xwiki:actions:beforePreview');
form.fire('xwiki:actions:preview');
form.action = XWiki.currentDocument.getURL('edit', 'editor=' + editor + '&language=en');
form.submit();
Event.stop(event);
}; Event.observe($('tmEditWysiwyg'), "click", function(event) {
switchEditor('wysiwyg', event);
}); Event.observe($('tmEditWiki'), "click", switchEditor.curry('wiki'));
}
</script>