CodeIgniter Forums
[SOLVED] TinyMCE and Form set_value problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [SOLVED] TinyMCE and Form set_value problem (/showthread.php?tid=26459)

Pages: 1 2


[SOLVED] TinyMCE and Form set_value problem - El Forum - 01-14-2010

[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/viewtopic.php?id=10090

Good luck!


[SOLVED] TinyMCE and Form set_value problem - El Forum - 01-14-2010

[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


[SOLVED] TinyMCE and Form set_value problem - El Forum - 01-15-2010

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


[SOLVED] TinyMCE and Form set_value problem - El Forum - 01-15-2010

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


[SOLVED] TinyMCE and Form set_value problem - El Forum - 01-15-2010

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