On 10/14/05, Dave Howorth <[EMAIL PROTECTED]> wrote: > > Yeah, that makes sense. The difficulty for me now is that since I don't > see validation as part of the user input any longer, the input side of > form-processing should stop short of that. > > That means FormBuilder's not looking as attractive to me as it did, > since it bundles everything together :( So I'll probably re-examine my > DFV stuff and is also why I'm keen to see what Maypole's standard > form-handling looks like in future. >
Not so fast! Yes, CGI::FB makes it easy to define validation at the UI. That's convenient, but the main purpose of that convenience is to allow it to build the javascript that validates a submission before it leaves the browser. You can also define entirely separate perl code to carry out validation on the server side. You do that by supplying coderefs to CGI::FB. So if you have a scheme that does validation in the model, you can hook that into CGI::FB. Not necessarily a pure solution, but if you have reasonably well encapsulated validation code used by the model, it saves you duplicating that for FB. Or, you could run FB with no validation, and catch the errors after sending data to the model. Admittedly, as CGI::FB stands at the moment, that's less satisfactory because (AFAIK) it's not possible to plug any errors back into CGI::FB's error reporting mechanism, which is a shame. I think it would be worth investigating if that can be done though. Maybe someone will write a DFV plugin for FB, that would be nice. Validation occurs at multiple stages, and the real question is whether a validation failure at each stage can be reported back to the client via a standard mechanism. CGI::FB gives you validation on the client side, and on the server side before sending data to the model. The model may have its own validation (especially if it's going to be used by multiple client apps e.g. web and CLI). And the database also has validation. As I say, it may be possible to hook the model's validation code into FB. Dealing with database validation errors is not easy though. d. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Maypole-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/maypole-devel
