I don't get one thing with forms and I guess with HTML5. I do build a form-text like this:
->add(
'subject', 'text', array(
'constraints' => array(new MaxLength(array('limit' => 5, 'message' => 'subject.maxlength'))),
'required' => true,
'attr'=>array('oninvalid'=> "setCustomValidity('". $this->get('translator')->trans('subject.oninvalid',array(), 'validators') ."')")
))
1.) Problem - form:
If I don't give any input into subject, the HTML-subject.oninvalid is coming up. When I reach the limit 5 because of MaxLength I send this form and I render an extra field error_messages, what doesn't look like subject.oninvalid. Why does symfony do pop up two different ways of errors? Why doesn't subject.maxlength is not popping up like subject.oninvalid?
2.) Problem - translation:
I do have a validators.en.xliff file with plural entries, what is working. Symfony is expecting by subject.maxlength plural translation. Why? How can I pass the %count%
like http://symfony.com/doc/2.0/book/translation.html#explicit-interval-pluralization in 'message' => 'subject.maxlength'
?