Tuesday, 13 May 2014

CakePHP TinyMCE Validation Problem

In development world, daily we face lot of problems, some are big while some are minor. Sometimes it takes a lot of time to fix small one than bigger ones. Similar to this, today I faced a small issue with TinyMCE in CakePHP. It was to set an attribute and to figure it out itself took couple of hours of mine. Then I decided to share it with my readers, thinking that it may save those couple of hours of someone else at some point of time.

Problem :

TinyMCE notempty validation was not working fine and it was showing following message on console.

An invalid form control with name='page [description]' is not focusable

Solution : Set required attribute to be false in view file. For example :

                <div class="umstyle3"><?php echo __('Page Description');?></div>
                <div class="umstyle4" ><?php echo $this->Form->input("description" ,array('rows' => 15, 'label' => false, 'div' => false, 'class'=>"umstyle5 w400p", 'required' => false))?></div>                                               

Reason : CakePHP validation rule automatically adds a required attribute to the field. So we have to remove it.

Hopefully, it will help someone.

If you guys are facing any other problem with CakePHP TinyMCE integration please let know. May be, I can help.

Thanks!!!!!!!! Enjoy Programming J

No comments:

Post a Comment

Thanks for your valuable comments.