Hi Tom,

 

This is actually ColdFusion default behaviour at work. If you don't specify
a scope CF will look in all of them for the variable. So when you are
referencing myFormVar, CF looks in URL, Form etc scopes to see if it exists.
It's not a good idea due to speed issues and the event scope should always
be used but good to be aware that CF does this.

 

James.

 

---

James  Allen

E: [email protected]

Blog: http://jamesallen.name

Twitter: @CFJamesAllen

Twitter: @JamesAllenVoice (Voiceover)

Twitter: @80sRewindShow (My weekly 80s radio show)

 

Tune in to the best in community radio - Codebass Radio:
http://codebassradio.net

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Tom Bishop
Sent: 17 February 2013 11:20
To: [email protected]
Subject: [Model-Glue] quick question

 

Hi,

 

I have been using Model-Glue for ages now but stumbled across something
puzzling. I accidentally left out of one of my controller methods the
myFormVar = arguments.event.getValue("myFormVar") call when processing a
form submission, and just referenced myFormVar lower down in the method but
found that the variable was being referenced without throwing an error. My
question, therefore, is: is there some sort of implicit copyToScope()
happening in controller functions? I even tested a controller method by
removing the event argument (ie <cfargument name="event">) and found that
the variables from the form scope were being correctly referenced.
Obviously, when I removed the event argument and tried
arguments.event.getValue("myFormVar") it then threw an error.

 

Any responses would be appreciated.

 

Thanks,

Tom

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups
"model-glue" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"model-glue" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to