0

As in the title, I Don't know why when I applicate CKEditor class to my Symfony2 Field Form as follow:

->add('contentCours', null,array(
    'label' => 'Content: ', 
    'attr' => array('class'=>'ckeditor')))

If the Form is submitted, I will got an SQL exception telling me that the colomun content_cours can't be null!

But that won't happen when I remove the CKEditor class atrri from the field...

I don't know what the wrong with that really, am I messing somthing? THanks for your help :)

Edit: To be more clear, I want the following => Don't subbmit the form if the "contenctCours" field is blank.

Abdou Bestmood
  • 475
  • 4
  • 15

2 Answers2

0

You should check if your CKEditor updates textarea field and correct POST request sent on form submit. This also may help "CKeditor update on submit post"

Community
  • 1
  • 1
Ziumin
  • 4,800
  • 1
  • 27
  • 34
  • Thanks for your answer...To be honset am not too good with Js and JQuery, I tried the solution you suggested but it doesn't work for me, the problem is always remaining... – Abdou Bestmood Dec 29 '14 at 11:31
  • anyway, it seems, that its frontend problem, not backend one – Ziumin Dec 29 '14 at 11:38
0

In my case CKEditor didn't sent POST data because of wrong type of field, i had <input> field but CKEditor needs to use <textarea> to save the POST data, so i had to change the field type from null or TextType to TextareaType.

Dont forget to import the class:

use Symfony\Component\Form\Extension\Core\Type\TextareaType;

Example:

->add('contentCours', TextareaType:class, array(
    'label' => 'Content: ', 
    'attr' => array('class'=>'ckeditor')
))
medskill
  • 320
  • 3
  • 13