开发者

cant post value in tinyMCE

desperately need help..

im using jquery & tinyMCE to submit the textarea but ive tried many options still the I cant post the value.. kindly need anyone to fix this code and give a clue.. your help is very much appreciated..thank you.. wiwien

<!--tinyMCE  -->
<script type="text/javascript" src="include/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    editor_selector : "wysiwyg"
});
</script>


<form id="formID" class="formular" method="po开发者_如何学编程st" action="">
....    
<fieldset>
                <legend>Creative Brief </legend>
                <label>
                    <span>Enter Your brief : </span>
                    <textarea id="briefnya" name="briefnya" rows="150" cols="150" style="width: 95%" class="wysiwyg"></textarea>
                </label>

<input type="hidden" id="userId" name="userId" value="<?=$userId;?>" >  
<input type="hidden" id="brief_html" name="brief_html" />
<input class="submit" type="submit" value="save and send CO"/>
</fieldset>
</form>


<script>
        $(document).ready(function() {
        /*var textarea = tinyMCE.get(briefnya).getContent();*/

        /*$('#brief_html').val(textarea);
        $("#formID").bind('form-pre-serialize', function(e) {
           tinyMCE.triggerSave();
        });*/
        /*$('#question_html').val(tinyMCE.get('question_text').getContent());*/

            // SUCCESS AJAX CALL, replace "success: false," by:     success : function() { callSuccessFunction() }, 
            $("#formID").validationEngine({
                beforeajaxsubmit:preSubmit(),
                ajaxSubmit: true,
                    ajaxSubmitFile: "formSubmit.php",
                    ajaxSubmitMessage: "Thank you, Your CO will be distributed. <a href=menu.php>Back to main menu</a>",
                success :  false,
                failure : function() {}
            });
</script>       


To get the HTML use something like this:

var content = tinyMCE.getInstanceById(element_id).getBody().innerHTML;

briefnya is your element_id.

Then you can post the contents of your textarea and it will contain your HTML from TinyMCE.


You can simply use

$('#id_of_textarea').val();

if you are already using jquery

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜