Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix html5 bug when textarea is required #223

Merged
merged 1 commit into from

5 participants

@ternel

space here.
if (/* cond */) {

@ternel

Hey @genemu ! Need this, soooo much :beers:

@bamarni bamarni merged commit f786c30 into genemu:master
@alejandrovinueza

Sorry for the late question, but I am getting an error when I set the required attribute

        ->add('job', 'genemu_tinymce' , array (
            'label' => 'job',                
            'required' => true                
        ))

The error gotten is "editor.onChange is undefined".

Is there something else I should configure to make it work the textarea as a required field?

@npotier

Hello, Is there any response to this problem ? I'm having the same problem than @alejandrovinueza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 Resources/views/Form/jquery_layout.html.twig
View
8 Resources/views/Form/jquery_layout.html.twig
@@ -60,7 +60,13 @@
{%- if configs.script_url is defined %}
- $('#{{ id }}').tinymce($configs);
+ var $textarea = jQuery('#{{ id }}');
+ if($textarea.is('[required]')) {
+ $configs.oninit = function(editor) {
+ editor.onChange.add(function(ed, l) { ed.save(); });
+ };
+ }
+ $textarea.tinymce($configs);
{% else %}
tinyMCE.init($configs);
Something went wrong with that request. Please try again.