Answer the question
In order to leave comments, you need to log in
How to set the default value in the symphony form field if it is empty?
Hello.
Is there a built-in method, if the database is null, then the corresponding form field is set to the default value (not placeholder, but value) when rendering.
I tried to set it through the 'data' property, but if the field in the database is filled anyway, the default value is set (from 'data'), but it is necessary, if there is a value in the database, then display it as the value of this field.
A separate question is how to fill in the value of the textarea fields, since it has its own nuances (the default value is the content inside the tag, as you know, and not the value attribute like inputs)
If there is no built-in solution, then of course you have to write a function - tell me where it is better to arrange it in terms of architecture, in the form class or something else?
Thanks
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question