Wysiwyg-editor: Supporting "required" attribute

Created on 21 Dec 2015  路  6Comments  路  Source: froala/wysiwyg-editor

Hi,

I tried to add the required="required" HTML5 attribute on a textarea that is replaced by froala, but I think it is not supported yet as the browser tooltip is placing himself at the top left corner of the viewport.

May I suggest you to add this feature to froala ? ;)

Most helpful comment

+1 this seems like a good feature to implement and I'm facing similar frustrations as well.

All 6 comments

The editor doesn't come with any such feature builtin. If you want to check that the editor is not empty, then you should use the html.get method and then display if the error message.

This is frustrating, because it causes errors in Chrome when a form is submitted without anything entered in a required textarea (i.e., native browser form validation).

See: https://jsfiddle.net/jgerigmeyer/dffhnu7L/1/

If you submit the form without entering anything in the Froala editor, it throws an error (An invalid form control with name='content' is not focusable.) instead of showing the browser validation message.

+1 this seems like a good feature to implement and I'm facing similar frustrations as well.

Do you have any news on this issue? It looks, like our customer has the same issue.

@stephen-puiszis actually it is easy to fix this issue by adding novalidate attribute to the form with editor, like this:

$('form#resource_html')..froalaEditor({...})
$('form#resource_html').attr("novalidate", true)

Update: it is not supported by all browsers.

Looks like the solution that I've provided fails to work in chrome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

george-norris-salesforce picture george-norris-salesforce  路  4Comments

kikeso77 picture kikeso77  路  3Comments

bbugh picture bbugh  路  3Comments

jmsche picture jmsche  路  3Comments

homoky picture homoky  路  3Comments