Answer the question
In order to leave comments, you need to log in
Should I use the Forms component?
For some reason I avoided it from the very beginning.
I thought to use only Model , View and Controller (according to MVC, well, or something like that).
But, the further things go, the use of validation (Validation) in the Model looks like a crutch.
For example, because error messages (messages) are different in the same model ("Invalid login or password" when registering and "Login field cannot be empty" when entering).
From here there is an idea to use forms (alas), but is there no other option? Is it worth using them at all?
Answer the question
In order to leave comments, you need to log in
in fact, the Forms component is probably in all frameworks and was created only to make life easier for the developer. Therefore, it is up to you to decide whether to use this component or not. Simply without it, you will have to manually do various data checks.
Using Yii2 as an example, work with forms is quite flexible there, there is full integration into the bootstrap, which draws all the fields for you in a couple of lines, if you need to customize outside the bootstrap, you can use a more flexible option, but there will be more code.
In laravel5, we can say there is a second option from Yii2, it makes the task easier, but is not tied to the bootstrap, while you need to write a little more code.
In general, in your case, look at the situation. If something is very custom, then write it yourself, but there will be more code, you can write your own component for forms for a specific project, and if the tasks are fairly standard, it is better to use a ready-made framework solution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question