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

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


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

Code:
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!
#12

[eluser]jjmax[/eluser]
Ben,

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,
John
#13

[eluser]jjmax[/eluser]
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 -
Code:
echo form_label('Body', 'content');
        if (isset($_POST['content']))
        {
            $value = $_POST['content'];
        }
        else
        {
            $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.
#14

[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:

Code:
<?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.
#15

[eluser]jjmax[/eluser]
Thanks Ben!
Will do.




Theme © iAndrew 2016 - Forum software by © MyBB