Hi, I'd like to ask the list wisdom for a somehow philosophical problem connected with this mail subject.
Let us start by considering the CURD example contained in Catalyst::Manual::Tutorial::AdvancedCRUD. In this example, the user enters his or her data using a form generated by the controller using HTML::Widget. While this approach presents the non negligible advantage to allow easy validation of entered data, and even automatic population of a database object, it has IMHO a problem in making the controller aware of things that should be known only to the view, namely how to actually compose the form in HTML, or even that a HTML form should be used at all (what if I want to use something like Catalyst::View::Wx for my user interface generation?). As I see it, the controller should tell the view 'I want the user entering the following data, each one with its data-type, and obeying the following constraints". But it is not the work of the controller to say _how_ the form should be presented to the user. Just as an example, if the user is supposed to choose one among several alternatives, it is a view decision if present the user with a drop down list, or a list of radio buttons. The only thing the controller is interested in, is that one, and only one among the proposed alternatives is chosen by the user. What I'd like, is to have the controller generate a "generic user interface form object" and pass it to the view. The view would the use the object to generate the actual form presented to the user. On reception of the request, the controller would have to find the object filled up with the user entered data (using some plugin[1]), and be able to check the constraints (via some "verify" method), and maybe use the object for actually filling a database object. What do the list members thinks about this? How do you generate your forms? Is there something like this already out, and I'm to stupid to find it? Note: [1] Yes,I know that plugins are discouraged, but for maintaining the 'View and Model agnosticism of Catalyst, filling the object from the request data can not be a method of the form object. -- Leo "TheHobbit" Cacciari
signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
