Skip to main content
Known Participant
April 21, 2010
Answered

Accessing cfc via form

  • April 21, 2010
  • 1 reply
  • 1271 views

I am dipping my toe into my first cfc...trying to get more oop oriented.

I have a cfc that I am developing for a login to will check if a user name exists in the db

...so that is one function.

I have a second function that accesses a web service from our Oracle environment that returns a boolean if they customer number is accurate and is on support.All of our customers know their number.

So I created a registration form with a user name field and a customer number field. In my action attribute, I reference my cfc as follows...

action="cfc/login.cfc?method=chkUser"

This seems to work fine for one function. I have two functions as I mentioned, so I thought I could "daisy-chain" the methods...

action="cfc/login.cfc?method=chkUser&method=Oraclechk"

This did not work. Seems that it looks for a method that is chkUser,Oraclechk, which of course, does not exist.

So here are my questions...

  1. Is there a way to submit multiple methods through the action?
  2. If not, then I think the best thing would be to combine my functions into one. The only problem is that one function (chkUser) returns a string, which tells the end user that the user name exists [my plan was to perform a cfif within my processing to display that to the end user]. The other function simply returns a status of active or inactive.

Thoughts?

Thanks,

Clay

This topic has been closed for replies.
Correct answer Dan_Bracuk

My approach would be:

Use cfobject or createobject to get access to the methods in the cfc.

Call the two functions separately.  You can use cfset or the equivalent cfscript code for this.

Process the returned information according to your requirements.

1 reply

Inspiring
April 21, 2010

A better way is to not submit forms to cfc pages.  Instead, submit them to cfm pages which call the cfc pages.

fs22Author
Known Participant
April 22, 2010

ok...I was simply following an article written by Ben Forta. I am fine doing it another way...Do you have an example somewhere?

Dan_BracukCorrect answer
Inspiring
April 22, 2010

My approach would be:

Use cfobject or createobject to get access to the methods in the cfc.

Call the two functions separately.  You can use cfset or the equivalent cfscript code for this.

Process the returned information according to your requirements.