Hi,

            I would like to know how to access text property of an TextInput control in a Form which is repeated inside a repeater? Here is what I was doing…..

I have two mxml file one department.mxml with repeater tag in it and another deptComp.mxml has form component with TextInput controls.

I was able to display data from the source xml file. I want to know how to set data in to TextInput controls of different instance.

 Also found files are attached for your reference. Any kind of help is appreciated. Thanks in advance.

 

Department.mxml contains……

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" >

<mx:Model id="deptList" source="Department.xml"/>

<mx:Repeater id="deptRepeater" dataProvider="{deptList.hari}">

      <deptComp deptModel="{deptRepeater.currentItem}" initialize="initialize()"/>   

</mx:Repeater>

</mx:Application>

 

DeptComp.mxml contains………

 

<?xml version="1.0" encoding="utf-8"?>

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:Script>

import mx.controls.Alert;

<![CDATA[                    

            function accessData( ) // display/set data from/to other instance

            {

                // I tried diff possible ways to access text property of TextInput control, deptName, but unable to display content.

              // None of the following Alert display text content.

                        Alert.show(this.parent.deptForm[1].deptName.text,"1");

                        Alert.show(this.parent.deptForm.deptName[1].text,"2");

                        Alert.show(this.deptForm[1].deptName.text,"3");                                      

                        Alert.show(this.deptName[1].text,"4");

                        Alert.show(deptName[1].text,"5");

                        Alert.show(deptForm[1].deptName.text,"6");

                        Alert.show(parent.deptName[1].text,"7");

                        Alert.show(this.parent.deptComp[1].deptForm.deptName.text,"8");

            }

]]>

</mx:Script>

 

    <mx:Model id="deptModel">

                        <deptNum></ deptNum >

                        <deptDesc></deptDesc>

                        <employees />             

    </mx:Model>

 

    <mx:Form id="deptForm" >

        <mx:FormItem >

               <mx:Button label="Click me" click=" accessData ()"/>

         </mx:FormItem>

        <mx:FormItem label="Dept ID:" >

            <mx:TextInput id="deptId" text="{deptModel. deptNum }" width="200"/>

        </mx:FormItem>

        <mx:FormItem label="Dept Name:" >

            <mx:TextInput id="deptName" text="{deptModel. deptDesc}" width="200" />

        </mx:FormItem>               

        <mx:FormItem label="Employees:" >

           <mx:DataGrid id="employee_dg" dataProvider="{deptModel.employees.employee}" />

        </mx:FormItem>

</mx:Form>

<mx:HRule width="668" height="20" />

</mx:VBox>

 

Thanks!
Hari

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Attachment: Department.xml
Description: Binary data

Attachment: department.mxml
Description: Binary data

Attachment: deptComp.mxml
Description: Binary data

Reply via email to