all groups > coldfusion flash integration > october 2005 >
You're in the

coldfusion flash integration

group:

Cannot pass form field variable from Flash form to CFC


Cannot pass form field variable from Flash form to CFC modernkaos
10/19/2005 4:31:37 PM
coldfusion flash integration:
hello,

could someone please help me with an issue i'm having....

i'm trying to pass data from flash form fields into my coldfusion component
using a insert into (mysql statement)...

but i can't add any data to my database....

<cfcomponent>
<cffunction name="InsertData" access="remote" returntype="string">

<cfquery datasource="mysql2" name="InsertData">
INSERT INTO newtable2 (NAME_USER, NAME_EMAIL)
VALUES ("#name#", "#email#")
</cfquery>
<cfreturn InsertData>
</cffunction>
</cfcomponent>

and i'm getting the following error...

Variable name is undefined.

my UI Input text field are names: name & email...
i've done all the bindings correctly..(from webservice to input field)
i've set a WSDL URL and operation name

i've added the getURL to my submit button that goes to a CFM
page with the following code...

<cfinvoke webservice="someURL.cfc?wsdl" method="InsertData"
component="mysql.myCFC" returnvariable="InsertData"></cfinvoke>

Am i doing something wrong ?

and that should input the data into the database but it's not...

could someone PLEASE help me with this Data Integration issue...

i just can't figure out why the data won't pass....

I need this to work for a project so any help in the right direction with be
great :)

thank you for all your help in advance

greg carron
flash programmer
greg@kingweb.com
Re: Cannot pass form field variable from Flash form to CFC aparsons
11/5/2005 9:26:50 PM
function insertUser()
{
checkpasswords();
var dummyVar:String=""; // to handle remoting quirk
// setup args call to insertUser method
var thisUser = {
dsn:"pjas",
username: _root.username.text,
password: _root.password.text,
active: _root.active.value,
school: _root.school.selectedItem.data,
permdesc: _root.permdesc.selectedItem.data,
fname: _root.fname.text,
lname: _root.lname.text,
email: _root.email.text,
phone1: _root.phone1.text
}
<cfoutput>
......
yadayadayada
......


Then in your CFC:

<cffunction name="insertUser" output="false" description="Inserts a new user
into the database" access="remote" returntype="query">
<cfargument name="userArgs" type="struct">
<cfset var addUser = "">
<cfset var lastID="">
<cfset var addUserContact="">
<cfset var GetMyRegion="">
<cfset var addUserRegion="">
<cfset var results="">
<!-- Set the active flag since Flash won't easily change from TRUE to 1-->
<cfif arguments.userArgs.active>
<cfset isActive = 1>
<cfelse>
<cfset isActive=0>
</cfif>

<cftransaction> <!--- missing type of isolation?? --->
<cftry>
<!--- add user --->
<cfquery name="addUser" Datasource="#arguments.userArgs.dsn#">
INSERT INTO user (userid,username,password,active,school_id,perms)
VALUES
(NULL,'#arguments.userArgs.username#','#arguments.userArgs.password#',#isActive#
,#arguments.userArgs.school#,#arguments.userArgs.permdesc#)
</cfquery>

......
yadayadayada
......
Re: Cannot pass form field variable from Flash form to CFC PaulH *TMM*
11/6/2005 10:28:47 AM
[quoted text, click to view]

you're not VARing isActive....this will cause you grief eventually.

<cfset var isActive=1>
..
..
..
<cfif NOT arguments.userArgs.active>
<cfset isActive = 0>
</cfif>
AddThis Social Bookmark Button