A
A
Anton Karmazin2012-10-12 11:32:34
symfony
Anton Karmazin, 2012-10-12 11:32:34

How to add a dynamic label in Symfony 1.4 when displaying a "required" error?

Welcome all!
In "ProjectConfiguration" you can override the text of the displayed errors, for example:

sfValidatorBase::setDefaultMessage('min_length', 'Минимум %min_length% знаков');<br>
sfValidatorBase::setDefaultMessage('required', 'Поле обязательно для заполнения');<br>

But for "required" there is no way to add a field name, like this for example:
sfValidatorBase::setDefaultMessage('required', 'Поле%label% обязательно для заполнения');<br>

How can I add this same% label%?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimusik, 2012-10-12
@Dimusik

I see several options for solving the problem:
1. You can write your own, custom template for displaying the form field with entertainment establishments and female robots and render the fields through it.
2. You can define an error message within the class of the form itself.
3. You can write your own validator inherited from sfValidatorBase in which to register the necessary placeholders.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question