INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Flex Text Input Control

Flex Text Input Control

(OP)
I'm new to flex and need some help...
I have a combo box which have 2 options get data from SQL based on either Employee Name or Employee ID and next to it is text input box to enter teh name or id. This is all in my mainapp.mxml. In my EmpRef.mxml I have datagrid and cold fusion connection coding. I'm confused how can I save user input entered in mainapp.mxml and based on it display data in EmpRef.mxml...
This is how my mainapp.mxml looks:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="0xFFFFFF" left="10" right="10" top="10" bottom="10" creationComplete="init()" xmlns:src="*">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.controls.Alert;
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.utils.ObjectUtil;
                        
            [Bindable] public var aryTXT:Array = ["Employee Name", "Employee ID"];
                        
            private function init():void {
            }
        ]]>
    </mx:Script>
    
    <mx:ComboBox id="cbTXT" x="10" y="31" dataProvider="{aryTXT}" fontSize="10" fontWeight="bold" width="170"></mx:ComboBox>      
    <mx:Label x="10" y="0" text="Employee Data" fontWeight="bold" fontSize="17"/>
    <mx:TextInput id="txt" x="188" y="32" width="170" height="24" fontSize="12" color="#3333ff" restrict="A-Z a-z 012345689"/>
    <mx:Button x="366" y="32" label="Search" fontSize="10" color="0x3333ff" click="vs.selectedChild=vsEmpRef"/>
    <mx:Button id="clearBtn" label="Clear" click="txt.text ='" color="0x3333ff"  x="439" y="32" width="65"/>
    <mx:ViewStack id="vs" left="0" right="20" bottom="10" top="62">        
        <mx:Canvas label="View 1" width="100%" height="100%">
        </mx:Canvas>
        <src:EmpRef id="vsEmpRef" width="100%" height="100%"/>
    </mx:ViewStack>
</mx:Application>


and this how EmpRef.mxml looks like:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" x="0" y="0" width="1200" height="766" creationComplete="initEmpRef()">
    <mx:Script>
    <![CDATA[
            import mx.utils.ArrayUtil;
            import mx.controls.Alert;
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            import mx.controls.dataGridClasses.DataGridColumn;
            
            [Bindable] public var EmpDataProvider:ArrayCollection;
            
            private function initEmpRef():void {        
                cf.getData();            
            }
            private function resultgetData(event:ResultEvent):void{
                EmpDataProvider = ArrayCollection(event.result);
                if(EmpDataProvider.toString()=='){Alert.show("No Data to Display");}
            }                
    ]]>
    </mx:Script>

    <!--Database Server Connection -->
    <mx:RemoteObject id="cf" destination="ColdFusion" source="Emp-debug.CFC.EmpRef" showBusyCursor="true">
        <mx:method name="getData" result="resultgetData(event)" fault="Alert.show(event.fault.message)"/>
    </mx:RemoteObject>         
        <mx:DataGrid id="OrderGrid" dataProvider="{EmpDataProvider}" left="10" right="10" bottom="60" top="10">
            <mx:columns>      
                  <mx:DataGridColumn headerText="Emp Name" dataField="Emp_Name"/>     
                    <mx:DataGridColumn headerText="Emp Number" dataField="Emp_Number"/>    
                    <mx:DataGridColumn headerText="LAST UPDATED" dataField="GroupSuffix"/>
                 </mx:columns>
        </mx:DataGrid>
</mx:Canvas>


and here is my CFC file:

<cfcomponent output="false">
<cffunction name="getData" access="remote" returnType="query" output="false">
    <cfset var DataQRY ="">
<cfquery datasource="SQL" username="User" password="PWD" name="DataQRY">
            select Emp_Name, Emp_Number
            from   Employee
        </cfquery>
    <cfreturn DataQRY>
    </cffunction>
</cfcomponent>


I really appreciate any help and thank in advance...
If you have any working example please refer me to it.
Thanks.      

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close