ColdFution Argument question


1) Would anyone explain what arguments  in (arguments.account) means and how to use it?
2) How do variables are passed from a page to anothe in ColdFusion?

Thank you,
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Coldfusion has different "scopes" which is the name before the period in the variable name.  Form.account or url.account or arguments.account.   Those are all different scopes in Coldfusion.   Each one represents where the variable comes from.  URL.account means the variable  account=bob was passed on the URL.   And FORM.account means that an input tag named account was submitted in a form post.   Arguments scope is used in a function.  It is the value passed into a function.   So if you called function   helloworld('bob')    then inside the function helloworld you would use  arguments.account to reference the variable passed to the function.

Pages...  it's a little unclear what you are asking.   There are no coldfusion variable on the web page because Coldfusion is server side.   Once the page is drawn to the browser, no variables exist.   So it is not coldfusion passing values to coldfusion once the page is drawn.      If you can give an example or some code, I can help clarify.
Rad1Author Commented:
Where does account come from in the helloworld('bob') ?

So if you called function   helloworld('bob')    then inside the function helloworld you would use  arguments.account to reference the variable passed to the function.
Right, I kind of skipped that.

When defining your function, the lines under the function name declare the arguments using <cfargument...>

In this case, the argument's name is Course_Number so calling getDescription(123) would assign 123 to argument.course_number

<cffunction name="getDescription">
    <cfargument name="Course_Number" type="numeric" required="true">

    <!--- Use the argument to get a course description from the database. --->
    <cfquery name="Description" datasource="cfdocexamples">
        SELECT Descript
        FROM Courses
        WHERE Number = '#Course_Number#'
    <!--- Specify the variable that the function returns. --->
    <cfreturn Description.Descript>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rad1Author Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.