if you are going to work with validation logic for the form ( text instead of numbers, dates out of range and such) I think Dennis's approach would be my personal option. That way you can encapsulate the validation inside the bean. am I correct guys? asking because I'm using this very same approach using makeEventBean(). Fernando
On Tue, Feb 16, 2010 at 5:48 PM, Chris Blackwell <[email protected]> wrote: > Here's a simple way to gather all your form fields back into a single > struct. > > <cfset formdata = structnew() /> > <cfset event.copyToScope(formdata, event.getValue('fieldnames')) /> > > If no form is submitted then fieldnames is not present (unless its been set > elsewhere) and you'll get back an empty struct, just like you would get an > empty form scope. > > -Chris > > > On 16 February 2010 21:37, Bob Silverberg <[email protected]>wrote: > >> You could use event.getAllValues() or event.copyToScope() to avoid having >> to use all of those individual getValue() calls. >> >> http://docs.model-glue.com/wiki/ReferenceMaterials/EventApi#EventAPI >> >> Cheers, >> Bob >> >> On Tue, Feb 16, 2010 at 4:16 PM, Preserved Killick <[email protected]>wrote: >> >>> Is this correct? >>> A form with 10 fields is submitted. >>> Modelglue.xml event handler broadcasts "dumpdata" with corresponding >>> controller that calls controller.cfc >>> >>> Controller.cfc asks my model to dump the data. >>> >>> Now..do I need to pass each form field to the model via the controller >>> as a var? >>> As in: >>> <cfset var field1 = arguments.event.getValue("field1") /> >>> <cfset var field2 = arguments.event.getValue("field2") /> >>> <cfset var field3 = arguments.event.getValue("field3") /> >>> >>> And then, in my models function each is named as an argument? >>> <cfargument name="field1" type="string" /> >>> <cfargument name="field2" type="string" /> >>> <cfargument name="field3" type="string" /> >>> >>> With a large form, this seems very tedious. Is there a shortcut? >>> >>> -- >>> Model-Glue Sites: >>> Home Page: http://www.model-glue.com >>> Documentation: http://docs.model-glue.com >>> Bug Tracker: http://bugs.model-glue.com >>> Blog: http://www.model-glue.com/blog >>> >>> You received this message because you are subscribed to the Google >>> Groups "model-glue" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected]<model-glue%[email protected]> >>> For more options, visit this group at >>> http://groups.google.com/group/model-glue?hl=en >> >> >> >> >> -- >> Bob Silverberg >> www.silverwareconsulting.com >> >> Hands-on ColdFusion ORM Training @ cf.Objective() 2010 >> www.ColdFusionOrmTraining.com >> >> >> -- >> Model-Glue Sites: >> Home Page: http://www.model-glue.com >> Documentation: http://docs.model-glue.com >> Bug Tracker: http://bugs.model-glue.com >> Blog: http://www.model-glue.com/blog >> >> You received this message because you are subscribed to the Google >> Groups "model-glue" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected]<model-glue%[email protected]> >> For more options, visit this group at >> http://groups.google.com/group/model-glue?hl=en >> > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<model-glue%[email protected]> > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en > -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
