Flex 2.0 - Combo box /TextField Population

Hi,
This is my first post on this forum. I have downloaded a
trial version of Flex 2.0, and I am creating a small application. I
have a combo box that has a few items( around 6 options), when
these items are selected a text box should update with text read in
from a txt file. I am able to get the combo working, but I don't
know how to read the text in from the txt file, so each option will
load in it's related text content from a txf file. How do I trigger
this from the combo ?
I have looked in at the help, but they say you have to
preload and use URL Loader...is this true ?...How to go about it ?
Please help, you can contact me at [email protected]

create a new project create a data folder and within a
data.xml paste this in the file:
<?xml version="1.0" encoding="UTF-8"?>
<RECORDS>
<RECORD>
<ID>1</ID>
<city>Suite 127 17008-90 Avenue</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T5T1L6anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%224313020%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A24%3A%22Biard+Financial+Servic es%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A26%3A%22Suite+127%2C+17008-90+Avenue</maplink>
<phone>(780) 907-9267</phone>
<prov>AB</prov>
<pcode>T5T1L6</pcode>
<uuid>A1A99A00-CEC7-C631-7940416FFBB9B6EE</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>2</ID>
<name>Bielertgary</name>
<city>Barr</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T0G0E0anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2263368%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A11%3A%22Bielertgary%22%3Bs%3A11% 3A%22AddressFl%22%3Bs%3A11%3A%225024+49a+St%22%3Bs%3A11%3A%22AddressCity%22</maplink>
<phone>(780) 674-2505</phone>
<prov>AB</prov>
<address>5024 49a St</address>
<pcode>T0G0E0</pcode>
<uuid>A1A99A10-C7A6-2C3F-17FE147F162E4AC3</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>3</ID>
<name>Bienvenu Michel Compt Agree</name>
<city>Cowansville</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=J2K1A1anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%224135469%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A27%3A%22Bienvenu+Michel+Compt+ Agree%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A20%3A%224150+Ste+Catherine+W%22%3</maplink>
<phone>(450) 931-0841</phone>
<prov>QC</prov>
<address>4150 Ste Catherine W</address>
<pcode>J2K1A1</pcode>
<uuid>A1A99A20-0163-5D90-7585D3C454987F6A</uuid>
<email>""</email>
<zoneID>Granby</zoneID>
</RECORD>
<RECORD>
<ID>4</ID>
<name>Big Red Income Tax and Accounting</name>
<fax>(780) 471-6221</fax>
<city>Edmonton</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T5G1K7anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2250452%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A31%3A%22Big+Red+Income+Tax+%26+A ccounting%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A14%3A%2211107+95+St+Nw%22%3Bs</maplink>
<phone>(780) 471-6251</phone>
<prov>AB</prov>
<address>11107 95 St Nw</address>
<pcode>T5G1K7</pcode>
<uuid>A1A99A2F-9E3F-7F4A-A47771D9B6638979</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>5</ID>
<name>Biggar Accounting Services</name>
<city>Biggar</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=S0K0M0anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2219880%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A26%3A%22Biggar+Accounting+Servic es%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A11%3A%22207+Main+St%22%3Bs%3A11%3A%2</maplink>
<phone>(306) 948-5133</phone>
<prov>SK</prov>
<address>207 Main St</address>
<pcode>S0K0M0</pcode>
<uuid>A1A99A3F-BCAF-7437-53DCE3CD8EAC334B</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>6</ID>
<name>Biggs Gary L Chartered Accountant</name>
<city>Edmonton</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=T6J6L1anddata=a%3A11%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A5%3A%2242764%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A33%3A%22Biggs+Gary+L+Chartered+A ccountant%22%3Bs%3A11%3A%22AddressFl%22%3Bs%3A25%3A%2210407+40+Avenue+North</maplink>
<phone>(780) 448-9221</phone>
<prov>AB</prov>
<address>10407 40 Avenue Northwest</address>
<pcode>T6J6L1</pcode>
<uuid>A1A99A4F-E8ED-C59F-58C5FC40A613E699</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
<RECORD>
<ID>7</ID>
<name>Bigras Roger C A</name>
<fax>(450) 625-0641</fax>
<city>Laval</city>
<maplink>
http://fb.411.ca/gmap.php?postal_code=H7P4A3anddata=a%3A12%3A%7Bs%3A11%3A%22customer_id%22 %3Bs%3A7%3A%223947434%22%3Bs%3A11%3A%22CompanyName%22%3Bs%3A16%3A%22Bigras+Roger+C+A%22%3B s%3A11%3A%22AddressFl%22%3Bs%3A26%3A%223180+Bd+Dagenais+O+Fabrvle%22%3Bs%3A</maplink>
<phone>(450) 622-6430</phone>
<prov>ON</prov>
<address>3180 Bd Dagenais O Fabrvle</address>
<uuid>A1A99A5E-DF97-BF84-6863D3385A2A5B86</uuid>
<email>""</email>
<zoneID>""</zoneID>
</RECORD>
</RECORDS>
then in the main application file paste this
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="xmldata.send();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
[Bindable]
public var mxdata:Object;
public function httpHandler(event:ResultEvent):void{
//the property lastresult dumps the object in the
application then the xpath allows you to get the propertysa you
want...
mxdata = xmldata.lastResult.RECORDS.RECORD;
private function server_fault(event:FaultEvent):void
Alert.show( ObjectUtil.toString(event.fault) );
]]>
</mx:Script>
<mx:HTTPService url="data/data.xml" id="xmldata"
result="httpHandler(event)" fault="server_fault(event)"/>
<mx:DataGrid dataProvider="{mxdata}"/>
<mx:ComboBox dataProvider="{mxdata}" labelField="name"
id="selectedData" x="10" y="179"/>
<mx:Form x="10" y="240">
<mx:TextInput id="ID"
text="{selectedData.selectedItem.ID}"/>
<mx:TextInput id="nameui"
text="{selectedData.selectedItem.name}"/>
<mx:TextInput id="fax"
text="{selectedData.selectedItem.fax}"/>
<mx:TextInput id="city"
text="{selectedData.selectedItem.city}"/>
<mx:TextInput id="maplink"
text="{selectedData.selectedItem.maplink}"/>
<mx:TextInput id="phone"
text="{selectedData.selectedItem.phone}"/>
<mx:TextInput id="prov"
text="{selectedData.selectedItem.prov}"/>
<mx:TextInput id="address"
text="{selectedData.selectedItem.address}"/>
<mx:TextInput id="pcode"
text="{selectedData.selectedItem.pcode}"/>
<mx:TextInput id="uuid"
text="{selectedData.selectedItem.uuid}"/>
<mx:TextInput id="email"
text="{selectedData.selectedItem.email}"/>
<mx:TextInput id="zoneID"
text="{selectedData.selectedItem.zoneID}"/>
</mx:Form>
</mx:Application>
i hope this helps : )

Similar Messages

  • Leading in combo box textfield

    Why the heck doesn't the leading get set on the textField in the combobox! ahhh!   The text format is being set correctly because the font/color/size are all good, and the dropdown is all good.  It's just the textField..
    private var tf_arial_enabled:TextFormat = new TextFormat(new ArialRegular().fontName, 16, 0xea8443, null, null, null, null, null, 'left', null, null, null, 2);
    theComboBox.setStyle("textFormat", tf_arial_enabled);
    ttheComboBox.textField.setStyle("textFormat", tf_arial_enabled);
    theComboBox.dropdown.setRendererStyle("textFormat", tf_arial_enabled);
    theComboBox.setStyle("embedFonts", true);
    theComboBox.textField.setStyle("embedFonts", true);
    theComboBox.dropdown.setRendererStyle("embedFonts", true);
    I haven't been here in awhile, sorry for code formatting if there ends up being a problem after posting

    A hack
    theComboBox.textField.setStyle("textPadding", -2);

  • Adobe Acrobat 9: Javascript array populated combo box - Selected answer will not save

    I have a combo box on one of my forms that is populated using a Javascript array.  The combo box is populating just fine, but when an item is selected from that combo box, the selected item does not save when the user saves the document.  Any suggestions as to what the problem is and how it can be corrected?  I am a loss as to where to even begin looking.  Any help is greatly appreciated.
    Thank you.
    Lisa

    You might also want to check the Scripting forum
    http://forums.adobe.com/community/acrobat/acrobat_scripting

  • Populating a combo box using values in a table

    I am trying to populate a drop down box with values from a table. I have got so far.
    The combo box is populated however the values in the box are blank.
    Can some suggest the necessary modifications?
    $query="select distinct(house_type) from tbl_accommodation";
    $stmt = ociparse($conn, $query);
    ociexecute($stmt);
    echo '<select name="house_type">';
    echo '<option value = "-1">Select:</option>';
    while($row=ocifetch($stmt)) {
         echo '<option>' . $row['house_type'] . '</option>';
         echo '</select>';
    Thanks

    The ocifetch() function needs ociresult() to get the data. See
    http://us.php.net/manual/en/function.oci-result.php
    You might want to use oci_fetch_assoc() instead.
    while($row=oci_fetch_assoc($stmt)) {
      echo '<option>' . $row['HOUSE_TYPE'] . '</option>';
    }For associative arrays, use the column name in upper case.
    NB Oci_fetch_assoc() is a PHP 5 function. If you don't have it, then
    you are using PHP 4 which has a much older version of the OCI8
    extension. I'd recommend upgrading PHP, or just replacing the old
    OCI8 with a newer one. See other recent threads about how to do this.

  • Combo Box, Converting string to int

    The user is able to select the month, year etc for a TimerTask using a combo box.
    The problem I have is converting say, "January" to an integer 0 for use to set in a calendar for the date.
    The combo box is populated with every month but i cannot link it with the int variable "month" where 0= january, 1- feb etc for use in the TimerTask.
    In other words, when the user selects "January" in the combo box i want the integer value for the variable "month" to equal 0, for "Febuary", month to equal 1, "March", month equal 2 etc etc.
    Any help would be excellent!!

    if January is the first item in the box, February is the second, all the way to December:
    month = monthComboBox().getSelectedIndex();

  • Need to detect when an item is clicked in a combo box in flex 3

    Hello
    I am having a check box and a combo box whenever any selection is made in combo box (current selection may be same as previous selection), I need to select the check box.
    By default the 1st item in combo box is selected and check box is unselected. Now I want that while 1st item is clicked in combo box (although it is selected) , the check box must be selected.
    I have currently used the change event of combo box to do my task. But it is not working if I click on same item as selected item in combo box.
    Also, I thought to use close event of combo box, but that event dispatches in 4 situations out of which I can distinguish only 1 situation from DropDownEvent(for close).
    Please help me regarding this.
    I am using flex sdk 3.5
    Thanks in advance.

    You can use the Close Event to distinguish it.
    To pull out which item has been selected in the combo box, you use the code (in as3)
    ComboBox(event.target).selectedItem.label
    and through the the use of an if statement
    if (ComboBox(event.target).selectedItem.label == "labelName")
    you can distinguish the single situation from the others.

  • Problem in populating 2nd combo box depending upon the selection of 1st

    Hi all,
    I have 2 combo boxes on my jsp page ,say continent and country . obviously the data in 2nd box is dependant on selection made in the 1st . I'm using MySQL with tomcat 5.0.7 . and JSP.
    The first combo box in one form and the 2nd in another. After submitting first i 'm populating the second combo also.
    But the problem is after submitting the first form the page gets refreshing and i can't see the selected continent in the first combo box.
    The javascript code used follows:
    function callCapture(form)
    var item = continent.cmbContinent.selectedIndex;
    document.country.hidContId.value=continent.cmbContinent.options[item].value;
    document.continent.action="country.jsp?hidContId="+document.country.hidContId.value+"&buttName="+document.country.buttName.value+"";
    document.continent.target="_self";
    document.continent.submit();
    some one pls help me asap !

    Hi Reegz,
    that's what i'm also doing and i'm successfull till populating the second combo box but how do I keep the previous inputs on the page and reload the page based on the change of a selection box?
    Is their any mistake in the javascript code:
    Here is the code:
    function callCapture(form)
    var item = continent.cmbContinent.selectedIndex;
    document.country.hidContId.value=continent.cmbContinent.options[item].value;
    document.continent.action="country.jsp?hidContId="+document.country.hidContId.value+"&buttName="+document.country.buttName.value+"";
    document.continent.target="_self";
    document.continent.submit();
    Pls help me...

  • Populating Database values into a combo box in STRUTS Framework

    Hi Guys,
    I am currently working on a STRUTS Framework project and I can't get much resources related to the problems that I'm facing.
    Currently I need to populate a JSP file's Combo box with database values. What I don't know here is the syntax used to in STRUTS framework to populate the Combo box with database values. Anyone with experience related to this topic, please kindly help me out.

    Struts doesn't define anything about the datab layer. You're free to implement how you will.
    Struts instead guides you into following an MVC pattern.
    You populate a combo box with values from a bean.
    So you need to set up a bean for this page to talk to.
    That bean can be populated from the database - but at that point you're in java/jdbc code - and away from the struts layer.
    My suggestions
    1 - Define a bean to represent the information from the database.
    2 - write a method that queries the database, and copies the data into a List of those beans. This will be your Data access layer.
    3 - in your action, call that method, and then set the list of beans as a request attribute. Or maybe as a property on a form.
    4 - use that list of beans to populate your dropdown box.

  • Populating combo boxes

    hi all,
    can any one help me in writing code for populating one combobox depending on selection in another combo box in java or javascript
    like country,state,city in address
    by selecting particular country in country combo box ,states belongs to that country should be populated in state combo box.
    please help me out which driving me mad
    Thank you for ur reply

    Haii arptihaa...
    The correct place to check for user attempts is after else condition of your login validation. Ie is a user login attempt will be checked once the login is failed.
    ie code some what look like this..
    session=request.getSession();
    if(validate user){}
    else
      Integer k=(Integer) session.getAttribute("userAtmpt");
      if(k==null)  //If the user is attempting for the first time
               k=new Integer(0);
            session.setAttribute("userAtmpt",k)
            url="login.jsp"
        else //If this is not first attempt
                  if(k.intValue>=3)  //if the user exceeds the no of attempts
                         url="lock.jsp";
                   else
                          k=new Integer(k.intValue()+1);
                          url="login.jsp"
    }Arpitha, I am not sure abt the syntax but logically it should be correct. Try get the flow and implement, u will get...
    regards
    Shanu

  • Combo Box Strange Sorting Behavior [Flex 1.5]

    The combobox does not sort if i set [Editable=true] using
    Flex 1.5.
    But works and sort fine and give accurate results if i remove
    Editable attribute from <ComboBox> tag.
    Initially i hv taken editable combobox and wants to sort the
    dataprovider as user enters the letter.
    but in vain.
    how can i achive the above.
    The keyDown event calls the following function:
    function
    setInitialItem(t:mx.controls.ComboBox,sDataValueInit:String):Void
    t.open();
    if(sDataValueInit.length==1 && (Key.getCode() >=
    65 && Key.getCode() <= 90))
    t.dataProvider.sortOn(sDataValueInit,Array.UNIQUESORT );
    }else if(sDataValueInit.length==2 && (Key.getCode()
    >= 65 && Key.getCode() <= 90))
    t.dataProvider.sortOn(sDataValueInit,Array.UNIQUESORT );
    }else if(sDataValueInit.length==3 && (Key.getCode()
    >= 65 && Key.getCode() <= 90))
    t.dataProvider.sortOn(sDataValueInit,Array.UNIQUESORT );
    }else if(Key.getCode() == 13 || Key.getCode() ==32){
    t.close();
    Thanks in Advance!
    Vinay

    If U have the list item as a combo box the maximun length property should be equal to the maximum length of the data displayed in the list.
    In Ur case,
    The length of 'FALSE' is 5.
    even the value to be stored is only '0'.
    The maximum length of the field should be 5.
    I don't think it's a bug. The very purpose of combo box is to let the users enter the new data at run time.

  • Problem pre-populating a combo box

    Hello,
    I am having problems pre-populating a combo box from a process.
    This combo box field exists in the OIM User Form and in another process form.
    Both combo box fields are populated from the same Lookup Definition: Lookup.Jazztel.TipoDeDocumento which looks like this:
    Code Key Decode
    1      DNI (NIF)
    2     Pasaporte
    4     Visado
    6     Nº Identificación de Extranjero
    9     C.I.F.
    I've tried these methods to pre-populate the combo box:
    * Using an adapter with a SET VARIABLE Logic Task (this adapter returns the code key that is selected in the OIM User form).
    * Using an adapter that returns the decode field from the code key and pass it to the Process combo box.
    In these cases, the process form combo box is not pre-populated correctly. It always shows C.I.F.
    I tried modifying the combo box in the following way:
    Code Key Decode
    DNI (NIF)      DNI (NIF)
    Pasaporte      Pasaporte
    Visado     Visado
    Nº Identificación de Extranjero Nº Identificación de Extranjero
    C.I.F. C.I.F.
    and it get pre-populated correctly.
    I need the code keys to be numbers. Does anyone know how can a combo like this be pre-populated?
    Moreover and curiously, the process form combo box appears ordered alphabetically (according to the decode fields):
    Code Key Decode
    9     C.I.F.
    1      DNI (NIF)
    6     Nº Identificación de Extranjero
    2     Pasaporte
    4     Visado
    and the OIM User Form Combo box, appears ordered numerically (according to the code key numerical order):
    Code Key Decode
    1      DNI (NIF)
    2     Pasaporte
    4     Visado
    6     Nº Identificación de Extranjero
    9     C.I.F.
    Does anyone know why?
    Thank you very much

    Try prepopulate combobox by lookup code.
    But it must displayed as decode.

  • Combo box with multiple variables pre populating multiple fields and max value validation script help

    I am creating a pdf form that will be used as a calculator, and my javascript knowledge is pretty rudimentary. I can do the simple things, some of what I need to do is over my head.
    1. I believe I need to use a combo box to pre populate certain fields. I have 13 variables in the dropdown to choose from, and whatever the client chooses will pre populate three other fields (and each of the 13 variables will populate those three fields differently). I'm not exactly sure how to go about doing this. Is it custom keystroke script or does it require a document script? Also, I'm guessing that whatever script will be a series of if/then statements, correct?
    2. Once all the fields have been populated (be it pre population or filled in by the customer), I need to calculate the answer which is not my main problem—I already have the proper calculations in place and they work. The problem is that the answer has a maximum value even if the actual value goes over that max number. So, the actual answer is 14 but the max value can only be 12. How do I get the calculation to replace that actual number (14) with the max number (12)? Is that in the validation tab or should that go elsewhere?
    I feel like I know just enough to be dangerous but not terribly effective. Any help is appreciated.  
    Thanks!

    1. There is a tutorial on this here:
    http://acrobatusers.com/tutorials/change_another_field
    2. To set the maximum value to 12, try this as the custom calculation script for the field:
    //Custom calculation script
    //Get value of text field
    var a = this.getField("Text1").value;
    //If it is > 12, then make it 12
    if (a > 12){
    a=12
    event.value = a
    You need to replace "Text1" with the name of the field in your form.

  • Populating Combo Box list value In Multiple Row

    Hi,
    i to have the same problem .
    I have used add_list_element to populate the list value of the combo box in multiple row.
    I am selecting the list value from the database where the combo box value will be different for each row. However, when i do this.
    All the previous row combo box list value will follow the combo box value in the last row. How can i resolve this?
    i tried with lov but hasnt had any sucesss.in case of LOV can we make the list to appear automatuically and select a value????i havent had much sucesss over it??
    is thr any work around for this apart from lov?

    Hi,
    which product or technology are you talking about ?
    Frank

  • Dynamically populating a combo box in Forms

    I am having a hard time figuring out how to dynamically populate a combo box at run time. Could someone give me any ideas?
    thanks, Robin

    Use the built-in Populate_list. Read help on that and you'll know how to set it up.

  • Error when populating combo box

    I tried to display my data in combo box from my access table but my combo box is empty. Here's my code:
    <% String temp="";     
         Connection conn = null;
         try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn = DriverManager.getConnection("jdbc:odbc:admin_management");
              Statement stmt = conn.createStatement();
              ResultSet rs = stmt.executeQuery("SELECT Virtual_host_name FROM Server_Info");
    %>
    <select name="Server_available">
    <%
    while (rs.next()) {
    temp= rs.getString("Virtual_host_name"); %>
    <%System.out.println("<OPTION VALUE=" + temp + ">" + temp + "\n");%>
    <%}%>
    </select>
    <!-- HEADER STARTS HERE--->
    <%
         catch(SQLException e)
              //out.println("SQLException: " + e.getMessage() + "<BR>");
              while((e = e.getNextException()) != null)
              out.println(e.getMessage() + "<BR>");
         catch(ClassNotFoundException e)
              out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");
         finally
              if(conn != null)
         try
              conn.close();
         catch (Exception ignored) {}
    %>
    Please help me asap. thanks!!

    Instead of "System.out.println" try using "out.println"

Maybe you are looking for