having said that, if you had the time and patience, you could do both.

have many individual arguments that each had a matching FORM scope
variable. That way you could be really picky with CFARGUMENT's type
checking and "required=no" for each one - use it either with
argumentCollection or individually...

just a thought



On 3/31/06, Barry Beattie <[EMAIL PROTECTED]> wrote:
> ah ha!
>
> argument collection is the "super struct" that contains all arguments
> (for want of a better description)
>
> cfset mybean.setMemento(#form#) />
>
> have you got only one argument (a struct) in setMemento()? it's not a
> collection. the "argumentcollection" would work if you had many
> arguments, each matching an item in FORM scope. Alternativelty,
> ommitting all the argument declarations in setMemento() should work
> too.
>
> yes?
> barry.b
>
> On 3/31/06, David Mineer <[EMAIL PROTECTED]> wrote:
> > The error I get is when using <cfset
> > mybean.setMemento(argumentcollection:form) />:
> >
> > Error casting an object of type to an incompatible type. This usually
> > indicates a programming error in Java, although it could also mean you
> > have tried to use a foreign object in a different way than it was
> > designed.
> >
> > However, after trying different things this does work perfectly:
> >
> > cfset mybean.setMemento(#form#) />
> >
> > This is exactly what I was hoping for.  The bean is populated with all
> > the form values with that one little line.
> >
> > Thank you for all your help.
> >
> > On 3/30/06, Chris Stoner <[EMAIL PROTECTED]> wrote:
> > > Interesting, are you trying to copy the data (or any part of it) into a 
> > > java
> > > object or make use of it from a java object in your method?  If you post
> > > your error message and the offending method I can probably help.
> > >
> > >
> > >
> > >
> > > On 3/30/06, David Mineer <[EMAIL PROTECTED]> wrote:
> > > > I can't get argumentcollection:form to work.  I get some kind of
> > > > Javacast error or such.  Only had a minute to try it real quick
> > > > yesterday.
> > > >
> > > > I would be interested in some code also.
> > > >
> > > > Thank you everybody for your responses.
> > > >
> > > > On 3/29/06, Cody Caughlan <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > You can write a Util function/class to populate a bean from a struct 
> > > > > of
> > > > > data. ColdSpring has this functionality and I wrote a simplified 
> > > > > version
> > > > > that takes a bean and a struct as input. The object loops over the
> > > struct
> > > > > keys and if an appropriate "set" method exists in the bean (using
> > > > > introspection you can retrieve the methods of a bean/CFC) and then 
> > > > > calls
> > > the
> > > > > set method with the struct key-value as input. Usually I just pass in
> > > the
> > > > > whole FORM scope to my Util object and all form fields are then
> > > > > auto-populated into my bean.
> > > > >
> > > > > Let me know if you're interested and I might be able to pass along 
> > > > > some
> > > > > code.
> > > > >
> > > > > /cody
> > > > > ________________________________
> > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On
> > > Behalf
> > > > > Of Joe Ferraro
> > > > > Sent: Wednesday, March 29, 2006 12:25 PM
> > > > > To: [email protected]
> > > > > Subject: Re: [CFCDev] passing from values to bean
> > > > >
> > > > >
> > > > > I don't know if this is worth mentioning.
> > > > >
> > > > > I remember back in the day talking about the arguments scope and 
> > > > > noting
> > > that
> > > > > though it looks like a struct it is actually a scope and doesn't 
> > > > > exactly
> > > > > work the same way. I don't know if that has changed at in the new
> > > release of
> > > > > CF. Since form is a scope too I wonder if you would encounter any 
> > > > > struct
> > > > > related incompatability issues there. The issues were minor. I think
> > > > > something like the key count returning different numbers based on if 
> > > > > you
> > > > > were using ver 6 or 7
> > > > >
> > > > > On 3/29/06, Chris Stoner <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > The form itself is a struct.  As long as the field names match the
> > > > > argument names in your setMomento method you can do something like 
> > > > > this:
> > > > > >
> > > > > > myBean.setMomento( argumentscollection:form )
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 3/29/06, David Mineer <[EMAIL PROTECTED]> wrote:
> > > > > > > I am missing something simple here, but what is the easiest way to
> > > > > > > pass form field values to a bean.
> > > > > > >
> > > > > > > I have a bean and I initialize it with default values.  The form 
> > > > > > > is
> > > > > > > populated with those default values.  When the form is submitted I
> > > > > > > want the bean to be updated with the new values.
> > > > > > >
> > > > > > > Do I loop over the form.fieldnames variable and use the bean
> > > setters.
> > > > > > >
> > > > > > > How do I incorporate the setMemento way.  Would that be 
> > > > > > > appropriate
> > > > > > > here.  Is there a struct of form.fieldnames that I can use.
> > > > > > >
> > > > > > > Tia
> > > > > > >
> > > > > > > --
> > > > > > > David Mineer Jr
> > > > > > > ---------------------
> > > > > > > The critical ingredient is getting off your butt and doing
> > > > > > > something. It's as simple as that. A lot of people have ideas,
> > > > > > > but there are few who decide to do something about them now.
> > > > > > > Not tomorrow. Not next week. But today. The true entrepreneur
> > > > > > > is a doer.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > ----------------------------------------------------------
> > > > > > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > > > [email protected] with the words 'unsubscribe cfcdev' as the subject 
> > > > > of
> > > the
> > > > > email.
> > > > > > >
> > > > > > > CFCDev is run by CFCZone ( www.cfczone.org) and supported by
> > > CFXHosting
> > > > > ( www.cfxhosting.com).
> > > > > > >
> > > > > > > An archive of the CFCDev list is available at
> > > > > www.mail-archive.com/[email protected]
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > ----------------------------------------------------------
> > > > > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > > > [email protected] with the words 'unsubscribe cfcdev' as the subject 
> > > > > of
> > > the
> > > > > email.
> > > > > >
> > > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported by 
> > > > > > CFXHosting
> > > (
> > > > > www.cfxhosting.com).
> > > > > >
> > > > > > An archive of the CFCDev list is available at
> > > > > www.mail-archive.com/[email protected]
> > > > >
> > > > >
> > > ----------------------------------------------------------
> > > > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > > > [email protected] with the words 'unsubscribe cfcdev' as the subject 
> > > > > of
> > > the
> > > > > email.
> > > > >
> > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> > > > > (www.cfxhosting.com).
> > > > >
> > > > > An archive of the CFCDev list is available at
> > > > > www.mail-archive.com/[email protected]
> > > > >
> > > ----------------------------------------------------------
> > > > >
> > > > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > > > [email protected] with the words 'unsubscribe cfcdev' as the subject 
> > > > > of
> > > the
> > > > > email.
> > > > >
> > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> > > > > (www.cfxhosting.com).
> > > > >
> > > > > An archive of the CFCDev list is available at
> > > > > www.mail-archive.com/[email protected]
> > > >
> > > >
> > > > --
> > > > David Mineer Jr
> > > > ---------------------
> > > > The critical ingredient is getting off your butt and doing
> > > > something. It's as simple as that. A lot of people have ideas,
> > > > but there are few who decide to do something about them now.
> > > > Not tomorrow. Not next week. But today. The true entrepreneur
> > > > is a doer.
> > > >
> > > >
> > > >
> > > ----------------------------------------------------------
> > > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > [email protected] with the words 'unsubscribe cfcdev' as the subject of 
> > > the
> > > email.
> > > >
> > > > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> > > (www.cfxhosting.com).
> > > >
> > > > An archive of the CFCDev list is available at
> > > www.mail-archive.com/[email protected]
> > > >
> > > >
> > > >
> > >
> > > ----------------------------------------------------------
> > > You are subscribed to cfcdev. To unsubscribe, send an email to
> > > [email protected] with the words 'unsubscribe cfcdev' as the subject of 
> > > the
> > > email.
> > >
> > > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> > > (www.cfxhosting.com).
> > >
> > > An archive of the CFCDev list is available at
> > > www.mail-archive.com/[email protected]
> >
> >
> > --
> > David Mineer Jr
> > ---------------------
> > The critical ingredient is getting off your butt and doing
> > something. It's as simple as that. A lot of people have ideas,
> > but there are few who decide to do something about them now.
> > Not tomorrow. Not next week. But today. The true entrepreneur
> > is a doer.
> >
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email to 
> > [email protected] with the words 'unsubscribe cfcdev' as the subject of 
> > the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> > (www.cfxhosting.com).
> >
> > An archive of the CFCDev list is available at 
> > www.mail-archive.com/[email protected]
> >
> >
> >
>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to