form decorators in zend framework
I a开发者_C百科m new to zend framework. I have used zend form and decorators to make form using class and decorators. The form i created was simple register form.
Now my question is "Is it advisable to use zend form for many complex forms as well ?" i have made many complex forms full of jquery with lots of conditions.. so at this moment i feel that it will very much difficult to make such form using decorators.The power of form is zend filters and zend validartios which saves our hell lot of time...
So can we make forms in our phtml files and still use the power of filters and validators or is dere any other way...???Well, my opinion would be to try to make the forms using Zend Form. The reason is that time spent on making Zend_Forms, setting up decorators, customizing elements or creating your own elements will be saved once the form is in use. With Zend Form you get very easy and straightforward way of validating your form, filtering contents of your fields, managing error messages, translating it, etc. In addition, once you spent time on e.g. writing your own or customizing existing decorators, form view helpers, form elements, it will be quite easy just to take them and use them in your next ZF project.
So in my opinion, in the long term using Zend_Form will save you time, even if at the beginning it may seem that using Zend_Form causes more troubles and headaches than not using them.
But off course, if you want to make your forms directly in phtml there is nothing that stops you. Both Zend filters and validators can be used on their own, independently of Zend_Form. You could also create zend form that has the same elements and structure as your "phtml form". This way you could only populate the zend_form, and use it only for validation and filtering of submmited data, not for actual rendering of your form.
精彩评论