Hi,
I am running into an issue.
a) I load FCK off of a text field with the word "hello" in it
b) the user deletes the word "hello", leaving no visible text in the editor field
c) user hits save and FCK posts the form
d) on the server side, I do not get a null/blank value, but I get some html (i.e. <br> or <p> tags). Hence I cannot effectively validate that the user filled out this required field.
How can I achieve this? What is the way to go about validating that the user actually typed something in the FCK editor? I need to be able to differentiate between leftover FCK html vs. what the user types in in order to prevent a user from not having to fill out a required field, or just blank out the field, but still be able to submit it because of the leftover fck html that results in a string > 0 length
thank you!
I am running into an issue.
a) I load FCK off of a text field with the word "hello" in it
b) the user deletes the word "hello", leaving no visible text in the editor field
c) user hits save and FCK posts the form
d) on the server side, I do not get a null/blank value, but I get some html (i.e. <br> or <p> tags). Hence I cannot effectively validate that the user filled out this required field.
How can I achieve this? What is the way to go about validating that the user actually typed something in the FCK editor? I need to be able to differentiate between leftover FCK html vs. what the user types in in order to prevent a user from not having to fill out a required field, or just blank out the field, but still be able to submit it because of the leftover fck html that results in a string > 0 length
thank you!
Re: After POST, how to detect "blank" value
But, if you are really having such problems, wouldn't be enough to check if the that is "<br />" or "<p></p>"?
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: After POST, how to detect "blank" value
Re: After POST, how to detect "blank" value
<p style="color: red"></p>
<!-- ... -->
<span></span>
One way to handle this is to traverse the DOM structure and look for text nodes. If you have any with non-zero length, you have some content. Another one is to run the result through an XSLT style sheet on the server and set output to text, so all HTML formatting will be stripped off.