Answer the question
In order to leave comments, you need to log in
How in Yii2 to organize the insertion of a form and a handler for it anywhere on the site by the admin?
Good afternoon!
There is such a task - you need to make a form generator on the site, which is already unsafe, I think, because it needs to be validated somehow, perhaps you need to write some kind of validation rule in the records of the form elements and check it using JS . If anyone can suggest a solution, I'd be grateful. But this is not the main problem.
In order to place a form anywhere on the site and change its location, as I understand it, it is possible, as an option, to set markers into which, when rendering the page, insert or not insert a certain form (almost all postal forms).
I'm more interested in how to make a handler for such dynamic forms and where to store it? Just beforeAction
comes to mindin some base controller. Please advise who did this?
Answer the question
In order to leave comments, you need to log in
There is such a task - you need to make a form generator on the site, which is already unsafe, I think, because it needs to be validated somehow, it may be necessary to prescribe some kind of validation rule in the records of the form elements and check with JS.
Hello. )))
If you have used the gii generator in Yii2, then you probably know that you can generate any forms there. So, if you personally need it, to quickly implement the creation of forms, then this solution is right under your nose, if you want it for users, it’s not entirely clear what the salt is, of course, then take the functionality from the box of your framework, there already everything is thought out and implemented. If this is a CMS system, then be prepared for the fact that the functionality should be clear to the most finished office plankton, or a newly-minted manager, and even a retired old woman, otherwise all the functionality, work, and time spent will be in vain. Which is more frustrating than non-working code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question