I'm using a CKEditor (along with a CKFinder). I need to validate the contents rendered by it before storing into a database.
If the contents rendered by the CKEditor is blank then a validation violation message should appear. This can be done easily on the server side but if a user only enters white-spaces and new lines then that should be trimmed and no contents should be inserted into the database violating the validation rule.
It is not possible by simply using a function like String.trim()
(regarding Java) on the server side because the CKEditor renders HTML. If I only enter some white spaces and new line characters then the HTML which is rendered looks something like the following.
<p>
</p>
<p>
</p>
Which actually represents some white-spaces and new line characters which cannot be trimmed by simply using a server side function. So what is the way to perform a validation in such situations?