From: Eric B. <eri...@ho...> - 2002-01-22 17:03:32
|
Hi Anthony, The goal of this demand, it's just to give the option to the user, to use FormProc as "validation by name" or "validation by type". It's not necessarily for a DBForms compatibility. If I re-use the same example, here I have 4 textfields using the same type of validation ("phoneCanada") and it can be re-use again in several other JSP pages. <db:textField fieldName="phoneWork" fieldValidator="phoneCanada"/> <db:textField fieldName="phoneHome" fieldValidator="phoneCanada"/> <db:textField fieldName="phoneCell" fieldValidator="phoneCanada"/> <db:textField fieldName="fax" fieldValidator="phoneCanada"/> Actually, if I want to do validation, I need to create 4 elements ("phoneWork", "phoneHome", "phoneCell", "fax") in "example-form.xml" and if fieldname haven't the same name in other JSP pages, we must to create as much of elements in "example-form.xml" as we have differents fieldnames ... Like this we will do a lot of duplication of element/validator and in reel, it's the same validation. To continue, maybe we can re-use FormProc for parameter validator in EJB, Web apps, Web Service, ... on the same server. This give you the opportunity to declare "Enterprise Validation Type" (EVT). You declare each type of validator in your xml file and it can be re-use by any kind of applications on this server ... or remotly using EJB. Because enterprise web server contains a lot of differents web apps on the same server and frequently use the same validation type, like this we can re-use it ... By adding the "context" (getter/setter) to the "FormData" class, when we call the process method, we will be enable to pass a context of this validation. ArrayList formDataList = new ArrayList(); formDataList.add(new FormData("phoneCanada", request("phoneWork"),"phoneWork")); formDataList.add(new FormData("phoneCanada", request("phoneHome"),"phoneHome")); ... But if a user want to work in "name" mode, it can continue to use the FormData("elementName", "value") constructor. Naturally, we need to be enable to retrieve the context in validation result. I think it's a good way to manage re-usable validation of data. Without modifying the core of FormProc. Thanks. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |