Question
CFC Return Message Best Practice
Hi,
I have a CFC file with all of my SQL queries. Some return results and some have queries which insert new records.
My question is, if I submit a form on say index.cfm which calls a CFC function to insert a new record, how can I then send a message back to the index.cfm to say what has happened? I use cftransaction and cftry blocks around most queries so a useful message depending on what happens regardless is almost essential.
One way I saw would simply be to do a cflocation with the message append to the URL but for other reasons I don't want to do it this way. e.g. <cflocation url="index.cfm?message=#urlEncodedFormat("Record inserted")#"
But that method above looks dirty. Is there another way? Hopefully a standard way of doing it that will work accross the board.
Many thanks for your advice - anything is much appreciated!
Mikey.
I have a CFC file with all of my SQL queries. Some return results and some have queries which insert new records.
My question is, if I submit a form on say index.cfm which calls a CFC function to insert a new record, how can I then send a message back to the index.cfm to say what has happened? I use cftransaction and cftry blocks around most queries so a useful message depending on what happens regardless is almost essential.
One way I saw would simply be to do a cflocation with the message append to the URL but for other reasons I don't want to do it this way. e.g. <cflocation url="index.cfm?message=#urlEncodedFormat("Record inserted")#"
But that method above looks dirty. Is there another way? Hopefully a standard way of doing it that will work accross the board.
Many thanks for your advice - anything is much appreciated!
Mikey.