Playing with CKEditor
← ejemplos
This example shows how to use FormValidation to validate a CKEditor element.
You should look at the basic principles when integrating FormValidation
with other plugins
Single editor
The Bio field is required and must be less than 200 characters long. We can't use the stringLength validator since the bio can contain HTML tags generated by the editor.
In order to achieve that, use the callback validator instead:
Instead of using the callback validator, you can use
the transformer option to get the raw
text provided by the editor before doing validations
As mentioned in the Compatibility section, the bio field must be revalidated when it is changed by the editor:
To trigger the 'change' event, you have to use
CKEditor v4.2 or later
Below is the working example:
Multiple editors
You can easily use and validate multiple CKEditor instances as the following code:
The example also uses the transformer option to indicate the pure
value of field from the editor before performing validations