2
votes

We are using a text editor in our web form (Tiny MCE). The form needs to be asserted using Symfony 2 that the text does not exceed 5000 characters, like this:

*  @Assert\Length(
*      max = 5000,
*      maxMessage = "Your text cannot be longer than {{ limit }} characters long"
* )

However, it appears the Tiny MCE is attaching HTML tags to the start of each new element which is affecting the assert. So a 4500 character piece of text is failing the validation due to the HTML tags being appended.

Is there a way of effectively striping out the HTML tags before Symfony does the assertions?

1

1 Answers

0
votes

Try this:

http://www.w3schools.com/tags/att_form_novalidate.asp

It disables form validation by HTML tags.