vartha
vartha

Reputation: 11

Posting edited text using tiny mce to cakephp form is not working

When I submit the text edited using tiny mce in cakephp while redirecting am not getting any text. Where am I going wrong? I am new to these things. Sorry for my language.

Here is the code:

    <script type="text/javascript">
    tinyMCE.init({
            // General options
            mode : "textareas",
            theme : "advanced",
            editor_selector : "mceSimple",
              ......
              ......
    }
    </script>

<form method="post" action="mains/dump.ctp">
        <textarea name="content" class="mceSimple" style="width:100%"></textarea>
        <a href="mains/dump" id="submitbtn"><span>Submit</span></a>
</form>

Upvotes: 1

Views: 636

Answers (3)

Leo
Leo

Reputation: 6571

CakePHP has no knowledge of your form as it is written in straight HTML without the appropriate naming style. Read this section of the book. It is probably the part of CakePHP you'll use more than anything else, so it's worth getting to know it.

When you've done that, read the rest of the book. CakePHP is not a framework you can just run with. You need some knowledge. If you had followed the blog tutorial, this would be second nature to you - the form helper is really basic stuff.

I would recommend that you keep things simple and not involve things like tinyMCE until you are comfortable with the PHP side of things.

As dogmatic69 says, you'll need to create the form element like:

echo $this->Form->input('content');

but for that to work, you'll also need first to declare the form like:

echo $this->Form->create('Main');

(unless you understand how CakePHP's form naming convention works).

Incidentally, you can also write it like echo $form->input('content');

Upvotes: 1

dogmatic69
dogmatic69

Reputation: 7585

you need to use echo $this->Form->input('content'); so that the form is submitted in the correct format.

you should always be using cakes form helper.

Upvotes: 2

Thariama
Thariama

Reputation: 50840

According to the tinymce API editor_selector is onyl functional toghether with mode : "specific_textareas", an not mode : "textareas",.

Upvotes: 0

Related Questions