View Full Version : dyanmic variables with Flash Remoting
fmdano
08-22-2005, 07:40 PM
Hey all, well, i now need to pass my dynamic radio button information from my Flash mx 2004 page, to a cold fusion cfc.
I am using flash remoting.
I may have 5, 6, 7, etc. radio buttons that the user may or may not click on. I need to pass the data to a cfc, so i can insert the data into a database and an email.
How can I pass data elements that are dynamic?
example(non dynamic):
getConRooms("conres", date, end_time, start_time, rb_1, rb_2, etc. );
thanks
dan
csdstudio
08-22-2005, 09:10 PM
A few ways.
one, the cfc code....
<cfcomponent>
<cffunction name="getConRooms" access="remote" returntype="any">
<cfargument name="infoObject" type="any" required="yes">
<CFQUERY NAME="query1" Datasource="yourdatasource">
INSERT INTO table (column1,column2,column3) VALUES ("#infoObject.data1#","#infoObject.data2#","#infoObject.data3#");
</CFQUERY>
<cfreturn true>
</cffunction>
</cfcomponent>
infoObject = new Object();
infoObject.data1 = "stuff";
infoObject.data2 = "stuff";
infoObject.data3 = "stuff";
getConRooms(infoObject);
PM me for more, I've had a ton of practice using flash remoting with CFCs and mySQL in the past few months.
~Rob
fmdano
08-23-2005, 01:10 PM
ok, that seems like a way i might be able to use.
So on my flash file, depending on what button(conference room) they press, a certain amount of info will display on the screen. so when i select room one, 6 items may be sent to the cfc. where room 2 may have only 4 and room 3 may have 2.
So, I guess the object will be created similar to the way an array would be created?
But, on the cfc, how would I create the query dynamically since i don't know if it will have say 6, or 4 or 2 items?
I will try to play with the object item and see if i can atleast pass the data to the cfc.
thanks
dan
fmdano
08-23-2005, 01:51 PM
as I started playing with the object code, i can pass all the radio button label data.
what if i only want to pass the radio buttons that were selected?
right now I have 6 radio buttons. what if the user selects 1, 2,5; how do i just pass those values?
my code to create the object is:
infoObject = new Object();
//infoObject.data1 = "stuff";infoObject.data2 = "stuff";infoObject.data3 = "stuff";
for(var s:Number = 0; s < _global.CartTotal; s++){
infoObject["data" + s] = reserveInfo_mc["r"+ s].label;
trace(infoObject["data" + s] + "~" + reserveInfo_mc["r"+ s].label);
}
all the above code passes is all the values, not just the ones the user selected. I am looping over the total number of radio buttons, not the ones selected. I guess I am not totally sure how to get the values from the Radio buttons, since they are created dynamically.
thanks for any other help you can give.
dan
fmdano
08-23-2005, 02:15 PM
sorry, sometimes i post before i research...i got all my data to pass...now on to the cfc...
thanks for understanding :)
dan
fmdano
08-24-2005, 02:48 PM
Sorry to bug people, but I have a question about accessing something on my cfc after it was passed from flash.
infoObject = new Object();
i created the above object which contains quite a few items. Lets say for example it contains the following:
infoObject.data1, data2, data3
when i pass the infoObject to my cfc using flash remoting, how do i access the individual items of the infoObject?
I don't know what type of item it is...doesnot seem to be a structure, array, etc.
I am still trying to find the answer...
thanks
dan
csdstudio
08-24-2005, 04:16 PM
That was also in my first reply above, you can see how to access the items of infoObject here...
<CFQUERY NAME="query1" Datasource="yourdatasource">
INSERT INTO table (column1,column2,column3) VALUES ("#infoObject.data1#","#infoObject.data2#","#infoObject.data3#");
</CFQUERY>
CF treats objects from AS as structures. :D
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.