View Full Version : Rich Text Editor

07-16-2012, 05:58 PM
Greetings CForums!

Haven't used javascript in quite some time and I'm creating a RTE for a friend of mine. I'm having problems using onClick="submitForm();" as I get no response from it.

Included are 2 files index.php and wysi.js. (modified to the problem area)
Any help would be greatly appreciated.

Thank you in advance. :thumbsup:



<body onLoad="iFrameOn();">
<div class="table_content_stretch"><b>Locked Down &raquo; Content Management System</b> &raquo; News
<br /><br />
<form action="news/process.php" name="wysiForm" id="wysiForm">
<p>Title : <input name="title" type="text" size="40" /></p>
<p>Category : <select name="category">
<option value="general" selected="selected">General</option>
<option value="trail">Trail</option>
<option value="parades">Parades</option>
<option value="hearse appearances">Hearse Appearances</option>
<option value="web update">Web Update</option>
<p>The News : (Do not use the buttons until after you have completed your form update.)<br />
<div id="wysiwyg_cp">
<input type="button" onClick="bold()" value="B" />
<input type="button" onClick="underline()" value="U" />
<input type="button" onClick="italic()" value="I" />
<input type="button" onClick="fontSize()" value="Font Size" />
<input type="button" onClick="hyperLink()" value="Hyperlink" />
<input type="button" onClick="image()" value="Image" /><br /><br />
<textarea style="display:none;" id="newsContent" name="newsContent" cols="100" rows="100"></textarea>
<iframe name="richTxt" style="border:#000 1px solid; width:550px; height: 300px;"></iframe>
<br />
<input type="button" value="Post" onClick="submitForm();" />


function submitForm(){
var wForm = document.getElementbyId("wysiForm");
wForm.elements["newsContent"].value = window.frames["richTxt"].document.body.innerHTML;

07-16-2012, 10:25 PM
var wForm = document.getElementbyId("wysiForm");
The method is getElementById, not getElementbyId (capitalisation).

07-16-2012, 11:08 PM
Wow... lmao. Thank you greatly!