House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search flex

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  Adobe Flex

A Beginner Question

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Good day,
Rob Parkhill
11/19/08 04:33 P
Hi Rob,
David Henry
11/19/08 04:43 P
David,
Rob Parkhill
11/19/08 04:47 P
Rob,
David Henry
11/20/08 08:58 A
David,
Rob Parkhill
11/20/08 09:13 A
Hi Rob,
Bob Keleher
11/20/08 04:14 P
thanks Bob,
Rob Parkhill
11/20/08 04:50 P
Hi Rob,
Bob Keleher
11/21/08 11:56 A
Hi Rob,
Bob Keleher
11/21/08 02:57 P
Bob,
Rob Parkhill
11/21/08 04:12 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/19/2008 04:33 PM

Good day, I have just started using Flex, as I think that it will suit my current app perfectly.  I have found most of the information that I have needed to get things going, but now I have come to a problem, and google is yielding no positive results.  I would like to pass some form results to a CFC for a datagrid.  I have the CFC returning fine when I click the submit button, but the arguments are not going in.  I am not sure how to bind them or pass them properly I guess. Any pointers would be greatly appreciated. Rob

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
David Henry
11/19/2008 04:43 PM

Hi Rob, Welcome to Flex!  What are you using to access the CFC?  RemoteObject perhaps? David Henry http://ColdFusionPowered.com/ Rob Parkhill wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/19/2008 04:47 PM

David, Yup, remote object.. here's a code snippet.  Not sure how to reference the form vars, like I said, nothing I was entering seemed to like me I tried to write an AS function (that is what is here, well at least the references) that was called by the submit button, but no go... <mx:RemoteObject       id="getSearch"       destination="ColdFusion"       source="vo.getSearch"       showBusyCursor="true"       fault="errorHandler(event)"> <mx:method  name="getSearch" result="handleSearchResult(event)"> <mx:arguments> <typer>{createVarsForSearch.typer}</typer> <s1>{createVarsForSearch.sss1}</s1> </mx:arguments> </mx:method> Rob On Wed, Nov 19, 2008 at 4:36 PM, David Henry < DavidHenry@coldfusionpowered.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
David Henry
11/19/2008 04:51 PM

I'm on my way out the door right now, I'll write up an answer for you when I get home (unless someone beats me to it). David Henry http://ColdFusionPowered.com/ Rob Parkhill wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/19/2008 04:56 PM

That would be much appreciated... and I am sure that you can expect a few more questions from me.  But it seems that with a couple of these simple things understood, I should be able to move forward at least... Thanks! On Wed, Nov 19, 2008 at 4:44 PM, David Henry < DavidHenry@coldfusionpowered.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
David Henry
11/20/2008 08:58 AM

Rob, Just to be sure I understand, you have a cfc called getSearch.cfc in the directory vo.  vo is either on the web root or mapped in the coldfusion administrator.  getSearch.cfc has a function in it also called getSearch which takes 2 parameters: typer and s1.  Is this correct? <mx:RemoteObject       id="getSearch"       destination="ColdFusion"       source="vo.getSearch"       showBusyCursor="true"       fault="errorHandler(event)"> <mx:method  name="getSearch" result="handleSearchResult(event)"> <mx:arguments> <typer>{createVarsForSearch.typer}</typer> <s1>{createVarsForSearch.sss1}</s1> </mx:arguments> </mx:method> David Henry http://ColdFusionPowered.com/ Rob Parkhill wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/20/2008 09:13 AM

David, Actually the cfc has the ability to take way more parameters, I was just trying to get two to work, and then add the rest.  They are coming from a search form where the user can select a type of thing to search for, and then add up to three strings of information using and/or checkboxes between each string and then it also has a start and end date, and I am considering adding a limit to the results as the DB is large enough. But yes, your assessment is correct, I can just add the rest of the vars as soon as I know the formatting :) Thanks, Rob On Thu, Nov 20, 2008 at 8:50 AM, David Henry < DavidHenry@coldfusionpowered.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bob Keleher
11/20/2008 04:14 PM

Hi Rob, Some things to try. First note that when you use mx:arguments the arguments are positional, i.e., 'typer' would match getSearch parameter 1 and 's1' would match getSearch parameter 2. The names are not matched. In your getSearch function try dumping whatever arguments are being sent to see if anything is, e.g. <cfset s=""> <cfloop index="i" from= "1" to="#arraylen(arguments)#">     <cfset s=s &  '|' & arguments[i] > <cfloop> <cflog file="myfile" text="#s#"> When calling the rpc try adding send(), e.g.     getSearch.getSearch.send(); Instead of using mx:argumants, try calling the rpc with named arguments like this:     getSearch.getSearch.send({typer:createVarsForSearch.typer, s1:createVarsForSearch.sss1}); , ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/20/2008 04:50 PM

thanks Bob, I have added the logging and your method of passing the vars to the CFC and I am getting nothing passed to the CFC.  Should I have to create a handler to do that form transformation?  or is there a way to reference the form vars directly... Sorry action script is new to me, but it seems like it will be the best solution for my current application. Let say that I have a form with a Radio group, three text input boxes, four check boxes, and two date choosers. (which  is exactly what I have)  what is the best way to pass that information to the CFC. Here is my AS for the createVarsForSearch function: public function createVarsForSearch():void{ var sss1:TextInput; var sss2:TextInput; var sss3:TextInput; var and1:CheckBox; var or1:CheckBox; var and2:CheckBox; var or2:CheckBox; var typer:RadioButtonGroup; var typer = searchType; //Search Type var sss1 = ss1; //Search String 1 var and1 = a1;// And Function var or1 = o1; // Or Function var sss2 = ss2; var and2 = a2; var or2 = o2; var sss3 = ss3; getResults(); } Thanks for any assistance! Rob On Thu, Nov 20, 2008 at 4:07 PM, Bob Keleher <bobk@cogeco.ca> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bob Keleher
11/21/2008 11:56 AM

Hi Rob, vars you declare within a function are only available within that function. here is a simple example of how to pass the information: private function doSearch():void {     remoteService.getSearch(); } ... <mx:RemoteObject       id="remoteService"    <---name changed to make it clearer       destination="ColdFusion"       source="vo.getSearch"       showBusyCursor="true"       fault="errorHandler(event)">     <mx:method  name="getSearch" result="handleSearchResult(event)">         <mx:arguments>             <typer>{searchType.text}</typer>             <s1> {ss1.text}</s1>        </mx:arguments>     </mx:method> </mx:RemoteObject> ... <mx:formItem label="Search Type:">     <mx:TextInput id="searchType" /> </mx:formItem > <mx:formItem label="Search String:">     <mx:TextInput id="ss1" /> </mx:formItem> ... <mx:Button label="Search" click="doSearch()" > ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/21/2008 12:51 PM

Thanks Bob, that is getting me going with the text boxes, but I have a radio button group, how do I get that value? In the MXML reference I see the functions possible for RadiobuttonGroups, but each reference I make seems to not like me so much..... Rob

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bob Keleher
11/21/2008 02:57 PM

Hi Rob, Here's one way:         <mx:arguments>             <typer>{searchType.text}</typer>             <s1> {ss1.text}</s1>              <rbitem>{firstButton.group.selectedValue.toString()}</rbitem>        </mx:arguments> ... <mx:RadioButton groupName="rbgroup" value="opt1" label="red" id="firstButton" /> <mx:RadioButton groupName="rbgroup" value="opt2" label="yellow" /> <mx:RadioButton groupName="rbgroup" value="opt3" label="blue"/ > <mx:RadioButton groupName="rbgroup" value="opt4" label="green"/ > As written, this will send the value of the value attribute to CF, e.g. "opt4" for "green". If you omit the value attribute, the selected label value will be sent, e.g. "green". Bob ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/21/2008 03:23 PM

Bob, well it seems as though that will work, however, when I save the project in FB I get the following warning: Data binding will not be able to detect assignments to 'group' Code: <rb> {ButtonGroup.group.selectedValue.toString()} </rb> <mx:RadioButton value="R" x="19" y="10" label="ReportID" groupName="searchTypeRadio" selected="true" id="ButtonGroup"/> <mx:RadioButton value="L" x="19" y="36" label="Lab ID" groupName="searchTypeRadio" /> <mx:RadioButton value="PC" x="19" y="62" label="Product Class" groupName="searchTypeRadio" /> <mx:RadioButton value="RS" x="19" y="88" label="Report Style" groupName="searchTypeRadio" /> <mx:RadioButton value="C" x="19" y="114" label="Customer" groupName="searchTypeRadio" /> If I preview the project anyways, it never ever loads... basically crashes I guess... Thoughts? Rob

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Douglas Knudsen
11/21/2008 04:02 PM

I've not got the time to read this whole thread, but I will suggest using AS code here not binding.  In your save handler, create the typed object and populate it from the form, then pass it to the RO call.  You are using typed objects, right?  If not, a real waste of time using RemoteObject IMO. I just presented at the CF_Unconference on hooking your Flex app to CF. There is a example of sending form collected input based on all three RPC types in Flex.  You can get the preso and code here http://www.cubicleman.com/2008/11/20/cf_unconference-flex-talks-to-cf/ HTH! Douglas Knudsen http://www.cubicleman.com this is my signature, like it? On Fri, Nov 21, 2008 at 3:16 PM, Rob Parkhill <robert.parkhill@gmail.com>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/21/2008 04:13 PM

Thanks Doug.. Sorry but I am a newb to Flex, and I know that it is going to suit my needs for a current project, so I am just trying to put together the building blocks that  I need for this. I am in the process of downloading your presentation and code, and hopefully that will clear it all up for me!! well maybe not ALL of it, but at least enough that I can pass some search parameters to my CFC! Thanks! Rob On Fri, Nov 21, 2008 at 3:53 PM, Douglas Knudsen <douglasknudsen@gmail.com>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bob Keleher
11/21/2008 04:07 PM

Hmm, I have it working fine that way. Oh well, how about trying passing the arguments this way: private function doSearch():void {     remoteService.getSearch(searchType.text, ss1.text, ButtonGroup.group.selectedValue, ...); } .... <mx:RemoteObject       id="remoteService"         destination="ColdFusion"       source="vo.getSearch"       showBusyCursor="true"       fault="errorHandler(event)">     <mx:method  name="getSearch" result="handleSearchResult(event)">     <!-- drop arguments tags --> </mx:RemoteObject> .... <mx:Button label="Search" click="doSearch()" > ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rob Parkhill
11/21/2008 04:12 PM

Bob, Is there some function that needs to be imported so that the toString() works? Rob ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists