Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] TinyMCE and Form set_value problem

[eluser]Ben Edmunds[/eluser]
dude read the post, this is happening before anything ever touches the database. It's in the form validation.

Looks like you might have to do it with JS like so:

var tiny = tinyMCE.get('editor1');
tiny.setContent('HTML content that got passed through POST.');

You can reference this post for more info: http://tinymce.moxiecode.com/punbb/viewt...p?id=10090

Good luck!


You're a legend!
This sounds like a good solution. Thanks for that and the link.
I'm at home now, but will do the fix in the morning. I'll let you know how it goes.

All the best,

Hey guys,

I tried your idea Ben but wasn't sure about getting it to work, so started trying to attack this problem form a different angle.

Instead of using the CI form helper to create the textarea, I did this -
echo form_label('Body', 'content');
        if (isset($_POST['content']))
            $value = $_POST['content'];
            $value = '';
        echo '<textarea id="main_content" rows="30" cols="90" name="content">' . $value .'</textarea>';

This works! Big Grin

Not sure how it is from a coding best practice point of view but it is getting the job done.

Thanks again for everyone's help. Hopefully this can help someone else.

[eluser]Ben Edmunds[/eluser]
Good job man!

If you're doing this in the view you can shorten your syntax a little like this if you want:

<?php echo form_label('Body', 'content');?>
<textarea id="main_content" rows="30" cols="90" name="content"><?php echo (isset($_POST['content'])) ? $_POST['content'] : '';?></textarea>

Either should work fine though.

Thanks Ben!
Will do.

Theme © iAndrew 2016 - Forum software by © MyBB