I'm customizing a wiki engine (derived from Wakka, for those who know), and adding a snazzy-looking little editor toolbar I found for it somewhere.
I'm wanting to add on that toolbar the submit button and preview buttons. But they don't work.
The code looks like this:
Code: Select all
<form id="ACEditor" name="ACEditor" action="http://localhost/wikini/wakka.php?wiki=TestPage/edit" method="post">
<input type="hidden" name="wiki" value="TestPage/edit" />
<input type="hidden" name="previous" value="561" />
<div id="toolbar">
<img class="buttons" onmouseover="mouseover(this);" onmouseout="mouseout(this);" onmousedown="mousedown(this);" onmouseup="mouseup(this);" onclick="wrapSelection(thisForm.body,'**','**');" src="UI/bold.gif" title="Bold selected text ( Ctrl-Shift-b )">
... lots of other buttons, I'm snipping them out of the way, they work and aren't relevant...
<img class="buttons" src="UI/separator.gif" >
<img class="buttons" onmouseover="mouseover(this);" onmouseout="mouseout(this);" onmousedown="mousedown(this);" onmouseup="mouseup(this);" onclick="thisForm.submit();" src="UI/save.gif" title="Saver" alt="Save" accesskey="s">
<img class="buttons" onmouseover="mouseover(this);" onmouseout="mouseout(this);" onmousedown="mousedown(this);" onmouseup="mouseup(this);" onclick="javascript:document.ACEditor.submit();" src="UI/preview.gif" title="Preview" alt="Preview" accesskey="p">
<img class="buttons" onmouseover="mouseover(this);" onmouseout="mouseout(this);" onmousedown="mousedown(this);" onmouseup="mouseup(this);" onclick="document.location='http://localhost/wikini/wakka.php?wiki=TestPage';" src="UI/cancel.gif" title="Cancel" alt="Cancel">
</div><textarea onkeydown="fKeyDown()" name="body" cols="60" rows="40" wrap="soft" class="edit">
Blablabla, text to be editted is displayed here.
</textarea><br />
... Now, we have standard buttons. These ones do work, but I'd like to be able to do without them...
<input name="submit" type="submit" value="Save" accesskey="s" />
<input name="submit" type="submit" value="Preview" accesskey="p" />
<input type="button" value="Cancel" onclick="document.location='http://localhost/wikini/wakka.php?wiki=TestPage';" />
</form>
I just don't know why the submit() function doesn't work as intended. All the sample scripts and tutorials and documentations I found online have not helped me understanding why it's not working. The toolbar's inside the form, I've tried several alternate methods (submit(), thisForm.submit(), document.ACEditor.submit(), etc.), to no avail.
Tested it both with I.E. and Firefox.
Other question, if I do get it to work, how can I transfer values, so as to differentiate between saving and previewing?