Jump to content

Loading tinymce when using <forms>


ankh2054
 Share

Recommended Posts

Hi All,

I have created a body field  and set the input type as Tinymce, but it does not load when I try to create a new page and populate the body field. The module is installed and enabled. 

Should I be doing anything else?

My code:

// Process new topic creation 
if($input->post->create_comment) {



    //Sanatize variables taking in the form data
    $title = $sanitizer->text($input->post->title);
    $body =  $sanitizer->textarea($input->post->body);

    $newPost = new Page(); // create new page object
    $newPost->template = wire('templates')->get('discussions-topic'); // set template
    $newPost->parent = $page; //Set the parent to the current page
    $newPost->title = $title; // set page title (not neccessary but recommended)
    $newPost->body = $body; //Set the body 
    //$newPost->discussions_author = $user;  //Might be able to remove this !!!!! check as I think processwire automatically remembers the username
    $newPost->save();
    

}

       <form class="form-horizontal" action="./" accept-charset="UTF-8" enctype="multipart/form-data" autocomplete="off" method="post">
                                <div class="form-group">
                                    <label for="inputFullname3" class="col-sm-2 col-md-3 control-label">Title</label>
                                     <div class="col-md-9">
                                        <input type="text" class="form-control" name="title" placeholder="Enter the Title" >
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputFullname3" class="col-sm-2 col-md-3 control-label">Body</label>
                                    <div class="col-md-9">
                                        <textarea name='body' rows='12' cols='80' id='body' placeholder="Your message"></textarea>
                                    </div>
                                </div>
                              </div>
                              <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                <button class="btn btn-primary" type="submit" name="create_comment" value="create_comment">Create Comment</button>
                              </div>
                              </form>

thanks for any help

Link to comment
Share on other sites

I think the TinyMCE Module isn't meant to be used in the frontend. At least ProcessWire doesn't generate stuff in your frontend, if you don't explicitly define it to do so and I don't see anything in your template which would call TinyMCE.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...