Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Rich Text Editor

    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.
    Code:
    //////////////////////////////////////////////////index.php
    
    ...
    
    <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>
    </select></p>
    <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 />
    </div>
    <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>
    </p>
    <br />
    <input type="button" value="Post" onClick="submitForm();" />
    </form>
    </div>
    <?php
    }
    ...
    
    ///////////////////////////////////////////////////////wysi.js
    
    function submitForm(){
    	var wForm = document.getElementbyId("wysiForm");
    	wForm.elements["newsContent"].value = window.frames["richTxt"].document.body.innerHTML;
    	wForm.submit();
    }
    Last edited by Anrk; 07-16-2012 at 06:11 PM.

  • #2
    New Coder
    Join Date
    Jul 2012
    Location
    Ukraine
    Posts
    71
    Thanks
    1
    Thanked 18 Times in 17 Posts
    var wForm = document.getElementbyId("wysiForm");
    The method is getElementById, not getElementbyId (capitalisation).

  • #3
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow... lmao. Thank you greatly!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •