Welcome Guest, Not a member yet? Register   Sign In
Problem with validation and FCKEditor
#1

[eluser]chandrajatnika[/eluser]
I use FCKeditor to create an article data, and I use validation rule on CI 1.7 for a better form validation but I have a problem..
When I\'ve submit a form and if one of required field is still empty then the page still on the edit form. But the content of my FCKeditor have convert like has been filter with htmlspecialchars.
Code:
include \"js/fckeditor/fckeditor.php\";
    $oFCKeditor = new FCKeditor(\'article_content\');
    $oFCKeditor->BasePath = base_url().\'js/fckeditor/\' ;
    $oFCKeditor->Value = $this->input->post(\'article_content\') ? $this->input->post(\'article_content\') : @$data->article_content;
    $oFCKeditor->Width = 800;                          
    $oFCKeditor->Height = 400;
    $oFCKeditor->Create();

Field \'article_content\' is required on my validation rule, same as another field like \'article_title\', if \'article_title\' is empty then the page will not change, but field \'article_content\' is filled with hmtlspecialchars result filter.
#2

[eluser]chandrajatnika[/eluser]
please help me...
#3

[eluser]onejaguar[/eluser]
Everything that comes out of $this->input->post goes through CodeIgniter's XSS_Clean process. You can access the original unmodified data in $_POST['article_content'] as long as you do it before $this->validation->run();

This of course could leave you open to scripting attacks so you should implement a more comprehensive validation solution that leaves HTML intact. I use HTMLPurifier, see my post here:
http://ellislab.com/forums/viewthread/80680/




Theme © iAndrew 2016 - Forum software by © MyBB