OK, So I've tried the code below, but I get the following error in flex:

<ERROR>
Severity        Description     Resource        In Folder       Location        
Creation Time   Id
2       Encountered "\n\n\t\t\tmx:Label x=\"10\" y=\"10\" text=\"Staff Code
Search\" id=\"label_StaffCodeSearch\" width=\"105\"/>\n\t\t\t" at line
77, column 143.
Was expecting one of:
    Style ...
    Script ...
    Metadata ...
    Model ...
    XML ...
    XMLList ...
    Array ...
    Binding ...
    String ...
    Number ...
    int ...
    uint ...
    Boolean ...
    Class ...
    Function ...
    Component ...
    Non-MXML language element ...
    Non-MXML language element ...       test6.mxml      LCTC_staffcodes line 77
18 April 2007 00:03:49  497
</ERROR>



When I use the following code, it errors on Line77... (Sorry for all
the code)...

<CODE>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
layout="absolute" backgroundGradientColors="[#0080ff,#80ffff]"
creationComplete="send_data()">


<!-- This is the Script to SetUp Functions-->
        <mx:Script>
                <![CDATA[
                        private function youveClicked():void {
                                mx.controls.Alert.show('You Clicked!!!');
                        }
                        private function send_data():void {
                        staffcodeRequest.send();
                        }
// THIS IS THE START - RESULT AS3 CODE I HAVE ADDED FROM THE ORIGINAL
<SNIP1>
                        result="staffcodeRequest(event)"
                    fault="faultHandler(event)">
                        
                        private function filterstaffcode():void{
                        staffcodeRequest.filterFunction = searchstaffcode;
                        staffcodeRequest.refresh();
                        }

                        private function searchstaffcode(item:Object):Boolean{
                        var isMatch:Boolean = false
                        
if(item.name.toLowerCase().search(search.text.toLowerCase()) != -1){
                        isMatch = true
                        }              
                        return isMatch;              
                        }

                        private function clearSearch():void{
                        staffcodeRequest.filterFunction = null;
                        staffcodeRequest.refresh();
                        search.text = '';
                        }
// THIS IS THE END - RESULT AS3 CODE I HAVE ADDED FROM THE ORIGINAL
<SNIP1>
                ]]>
        </mx:Script>


<!-- This is the HTTPService-->
        <mx:HTTPService id="staffcodeRequest"
url="http://192.168.0.84/amfphp/services/staffcode.php";
useProxy="false" method="POST">
                <mx:request xmlns="">
                
<firstname>{firstname.text}</firstname><surname>{surname.text}</surname><staffcode>{staffcode.text}</staffcode><emailaddress>{emailaddress.text}</emailaddress><department>{department.text}</department>
                </mx:request>
        </mx:HTTPService>
        
        <mx:Panel layout="absolute" cornerRadius="50" left="0" right="0"
top="0" bottom="58">


<!-- This is the Add Panel-->
                <mx:Panel layout="absolute" title="Add Staff Member"
id="panel_AddStaffMember" backgroundColor="#0080ff" width="796" x="10"
height="140" y="443">
                        <mx:Label x="10" y="10" text="First Name" 
id="label_FirstName"/>
                        <mx:Label x="444" y="12" text="Surname" 
id="label_Surname"/>
                        <mx:Label x="10" y="38" text="Staff Code" 
id="label_StaffCode"/>
                        <mx:Label x="444" y="38" text="Email Address" 
id="label_EmailAddress"/>
                        <mx:Label x="10" y="66" text="Department" 
id="label_Department"/>
                        <mx:TextInput x="96" y="8" width="200" id="firstname"/>
                        <mx:TextInput x="530" y="10" width="200" id="surname"/>
                        <mx:TextInput x="96" y="36" width="200" id="staffcode"/>
                        <mx:TextInput x="530" y="36" width="200" 
id="emailaddress"/>
                        <mx:TextInput x="96" y="64" width="200" 
id="department"/>
                        <mx:Button label="Submit" 
click="send_data(),youveClicked()"
x="304" y="64" id="button_SubmitButton"/>
                </mx:Panel>


<!-- This is the Show and Search Panel-->
                <mx:Panel x="10" y="10" width="796" height="425" 
layout="absolute"
backgroundColor="#0080ff" id="panel_DisplayStaffMember" title="Search
Staff Member">
                        <mx:DataGrid id="dgStaffcodeRequest" x="10" y="114"
dataProvider="{staffcodeRequest.lastResult.stafflist.staffid}"
width="567" height="231">
                                <mx:columns>
                                        <mx:DataGridColumn headerText="Staff 
Code" dataField="staffcode"/>
                                        <mx:DataGridColumn headerText="First 
Name" dataField="firstname"/>
                                        <mx:DataGridColumn headerText="Surname" 
dataField="surname"/>
                                        <mx:DataGridColumn 
headerText="Department" dataField="department"/>
                                </mx:columns>
                        </mx:DataGrid>
                        
<!-- THIS IS THE START - THE ERROR LINE-->
                        <mx:TextInput x="10" y="353" id="selectedemailaddress"
text="{dgStaffcodeRequest.selectedItem.emailaddress}" width="284"
textAlign="left"/>
<!-- THIS IS THE END - THE ERROR LINE-->

<!-- THIS IS THE START - RESULT MXML CODE I HAVE ADDED FROM THE
ORIGINAL <SNIP1> -->
                        <mx:Label x="10" y="10" text="Staff Code Search"
id="label_StaffCodeSearch" width="105"/>
                        <mx:TextInput x="123" y="8" width="61"
id="txtinput_StaffcodeSearchInput"/>
                        <mx:Button x="192" y="8" label="Search" 
click="filterstaffcode()"
id="button_SearchButton"/>
<!-- THIS IS THE END - RESULT MXML CODE I HAVE ADDED FROM THE ORIGINAL
<SNIP1> -->

                </mx:Panel>

        </mx:Panel>

</mx:Application>
</CODE>



The Original <Snip1> code works fine upuntil I add the filterFunction.


;-) TIA
Danny


Reply via email to