Set point problem selected in the drop-down list box that is the XML data provider

HI - new to Flex, experienced Java dev., hoping someone can help me see the light of what should be easy but...

I have a Flex 3 MXML application form that contains a ComboBox as follows:
< mx:ComboBox id = "physRegion" editable = dataProvider = "{regionRequest.lastResult.region 'false'}" / > "

The combo box is filled by the provider of data like:
MX:HTTPService id = "regionRequest" url = "flexDAOServlet" resultFormat = "e4x" method = "POST" >
< / mx:HTTPService >

and the underlying XML code looks like this:
<>region
Northland < label > < / label >
< value > 1 < / value >
< / region >
<>region
Auckland < label > < / label >
< value > 2 < / value >
< / region >
...

Drop-down list box loads the XML code very well. the user can select an item and the appropriate value is submitted to the server without problem. My problem is when I want to "recharge" the form with previous values.
I can reload the text without problem fields.

But I can't work in my ActionScript function, how to set the combo box so that it displays "Auckland" for example, the element with the value = 2. I'll be back this server id, even if I could get the XML code or label if that would help me solve this problem.

I tried physRegion.selectedItem = "Auckland" - nope. "
I tried physRegion.selectedItem = 2 - nope.
I tried
var XML = myXML:XML ("< region > < label > Auckland < /label > < value_2 > < value > < / region >");
physRegion.selectedItem = myXML;
and - nope.

I know that I'm a new style user here error (and thank you for reading this far! your patience is appreciated) but I can't for the life of me see what it is. Can anyone help?

Many thanks in advance for clues. Apart from that, I'm loving Flex.
Kind regards
Adrian

Two things to note. The only problem with the function that has provided ChiefRocka00 is that it is based on the identifier of the data, which means your always limited to have that be the identifier of your value. Personally, I'll be back queries a lot of times where the labelFIeld and dataField aren't labels / data pairs a suggestion would be to add a third parameter and have it checked for this identifier instead of the data. The other thing to note is that it is more common to use selectedIndex instead of selectedItem. If you do not want to do something more like physRegion.selectedIndex = selectCboIndexByData ("physRegion, ' Auckland", label) by using the update function of

public void selectCboIndexByData(theCbo,_theDataValue,_identifier:String):Number {}
for (var i: Number = 0; i< thecbo.dataprovider.length;="">
If (theCbo.DataProvider.getItemAt (i) [ID] == theDataValue) {}
Return i;
}
}
return 0;
}

Tags: Flex

Similar Questions

  • How to change the items in a drop-down list box that is part of an array of clusters

    Hello

    In the attached vi, I have an array of clusters and each cluster contains two drop-down list boxes. How can I edit the items in the drop-down list box 1 for all elements in the array? (All elements of list box 1 has the same elements.)

    By way of illustration, I have also included the case of trivila, for example, edit the items in a separate drop-down list box that is is not part of an array of clusters (combo box 3). Please notify. Thank you.

    Peter

    Right click on the drop-down list box and select Create-> Node-> String() property. Place it on the block diagram. Change to write (right click) and then feed him an array of strings.

  • How to make a pdf that can send a form to e-mail selected in a drop-down list box?

    I'm trying to be able to create a user of a pdf file I created, select an e-mail from a drop-down list box and then hit send and have it send to this email address that has been selected.

    Thanks for the help!

    Hello

    I don't think (maybe wrong) you can do this in InDesign. At the very least, you could draw the shape in InDesign, but I guess that the interactivity between the selection of the list and the action of mail should be done with Scripting Acrobat or LiveCycle Designer if you have.

    FWIW,

    Loïc

  • Show drop-down list field hide selection in another drop-down list box

    Hello I need to create two drop-down fields on a dynamic PDF in LiveCycle. The first field contains three choices. When a user selects an item in the drop-down list first I would like to a new field of drop-down list has been shown. For each item in the first drop-down list appears a new field drop-down list with unique values. If the user chooses blue drop-down list of blue shades indicate in this menu drop-down will be various shades of blue to choose for. If the Red is chosen, Shades of Red dropdown with appearance and if yellow is displayed the same occurs. Also if the user must go back and change their selection in the first drop-down list, they can do the same. Any suggestions?

    Thank you in advance.

    There are 2 ways you could do this. The first is just to have the 3 drop-down lists for the second box to separate and do them all hidden. The output of the first dropdown event would then have the code that would make it the second box become visible, something like (in formcalc):

    If ($ == 1) then

    dropdownRed.presence = "visible".

    dropdownBlue.presence = "hidden".

    dropdownYellow.presence = "hidden".

    ElseIf ($ == 2) then

    dropdownRed.presence = "hidden".

    dropdownBlue.presence = "visible".

    dropdownYellow.presence = "hidden".

    ElseIf ($ == 3) then

    dropdownRed.presence = "hidden".

    dropdownBlue.presence = "hidden".

    dropdownYellow.presence = "visible".

    endif

    The other option is just to have a dropdown that dynamically changes its options based on the results of the first box. So in the second box preOpen event you might have something like (in formcalc):

    If (dropdown1 == 1) then

    $. clearItems()

    $.setItems ("light red, dark red")

    ElseIf (dropdown1 == 2) then

    $. clearItems()

    $.setItems ("sky blue, dark blue")

    ElseIf (dropdown1 == 3) then

    $. clearItems()

    $.setItems ("light yellow, dark yellow")

    endif

  • Adobe Acrobat 9: Javascript populated the drop-down list box - response selected array will not save

    I have a combo on one of my forms box that is filled with the help of a Javascript array.  The drop-down list box is filling very well, but when an item is selected in this drop-down list box, the selected item does not save when the user saves the document.  Any suggestions as to what is the problem and how it can be corrected?  I am a loss to know where even to start the search.  Any help is greatly appreciated.

    Thank you.

    Lisa

    It seems that the drop-down list box may be getting filled with code that runs when the form is opened. If so, it will overwrite the value selected, whenever it opens. The solution would be to change the code so that it is not than that. If not, you can post the form somewhere so we can take a look?

  • Select the item in the drop-down list box?

    Hello, I have a list box drop-down list box that contains numbers from 1 to 10. Normally, it will display "1" when the application starts, but how I put it in AS3 to show "3" instead?

    comboboxInstancename.selectedIndex = 2;

  • Jdev v.10.1.3.4 - hide inputtext af based on the drop-down list box

    Hello

    I'm trying to hide and display a text entry box based on what is selected by a drop-down list box. I have some difficulty getting the javascript code I think that to read the value of the selection box.

    Here is a simple example of what I'm trying to do. I tried a couple of different ways but no luck. I appreciate any help anyone can offer.

    Thank you
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
      <afh:html>
        <afh:head title="test">
          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    
        </afh:head>
        <afh:body>
    <f:verbatim>
            <script type="text/javascript">
            function changed(){
               if(document.getElementById("current").value =="1" ){
                document.getElementById("currentSize").style.display='block'; //show textbox
                }
                else{ 
                document.getElementById("currentSize").style.display='none'; //hide textbox
                }
            }
            
            </script>
    </f:verbatim>
        
        
        
        <h:form>
            <af:selectOneChoice id="current" label="select item" onchange="change();">
              <af:selectItem label="item 1" value="1"/>
              <af:selectItem label="item 2" value="2"/>
              <af:selectItem label="item 3" value="3"/>
              <af:selectItem label="item 4" value="4"/>
            </af:selectOneChoice>
          <af:inputText label="Input Size:" maximumLength="5" id="currentSize" columns="7" rows="1"/>              
          </h:form></afh:body>
      </afh:html>
    </f:view>

    It works if you use af:form instead of h:form?
    What happens if you set the partial relaxation of the af: form to point to the 'current '?

  • Filling of a numeric field by selecting from a drop-down list

    Hello all;

    I went through the 38 pages on the form now to try to understand it myself. I must have missed something or this day becomes medium long.

    I am filling a numeric field that is based on what is selected in a drop-down list box.

    For the test, I use only 2 fields

    DropDownList1 and digital Field1

    I If (DropDownList1.rawValue == 1) { }

    NumericField1.rawValue = 25;

    }

    On the other;

    (DropDownList1.rawValue == 2) { }

    NumericField1.rawValue = 35;

    }

    That worked. I am now getting the error "missing; before the statement

    "6:xfa: form1 [0]: #subform [0]: DropDownList [0]: output"

    Specify the value of points is checked in the tab links for DropDownList1.

    I said this with a single selection, who worked

    if (DropDownList1.rawValue == 1) { }

    NumericField1.rawValue = 25;

    }

    Thank you all

    Chomp

    If it's a copy/paste of your script, you have a semicolon after the "else" and "else" should be lowercase.

    And for nested IFS, you need an "else if", so:

    If (DropDownList1.rawValue == 1) {}

    NumericField1.rawValue = 25;

    }

    Else if (DropDownList1.rawValue == 2) {}

    NumericField1.rawValue = 35;

    }

    ElseIf...

    If you have a lot of statements, you might want to look at using a statement that may be easier to read.

    {Switch (DropDownList1.RawValue)}

    case '1 ':

    NumericField1.rawValue = 25;

    break;

    case '2 ':

    NumericField1.rawValue = 35;

    break;

    etc.

    }

  • Not by selecting for viewing, but don't drop-down list box option

    Is it possible to have an option in a drop-down list box that is the first thing that people see, but not a selection? The field is mandatory, but I don't want the first option to be shown. For example:

    < select a >

    option 1

    option 2

    option 3

    Thanks in advance

    Nope.

  • Selection in the drop-down list box determines the text to display in another box - ideas?

    Hello, my name is Zac.  I spent a lot of time trying to figure this one out for myself, but I couldn't find what I needed.  A few threads looked promising, but I realized that they only apply to the LiveCycle.  Many other threads link to discussion 2006 Thom Parker on this subject, but it is very advanced and I feel that what I need is not as complex as the solution he proposes.  I've never used Adobe Acrobat until a few weeks ago, but with the help of Bernd Alheit and George Johnson I managed to create a document with fly-out help windows and scrolling lists and radio buttons which dictate the choice.  It's great and it works.  The last thing I have to do is to create a text box (or some kind of box) which will display a pre-written block of text based on the user choice in another area (a drop-down list box).  Like this:

    image for forums 2.PNG

    I wish, it is also easy to create because it draw a picture of him!  If the user selects "Algebra 1", for example, a specific description display below.  There are a lot of courses and descriptions, and the descriptions are long enough (as shown).  It is not necessary for the user to make changes to the description - in fact, which would be terrible.  But I would like to be able to copy text from it and paste the text in another area of text on the same page.

    Thank you very much, all those who have ideas please share them! Again wild guesses. I learn from all this.

    -Zac

    This involves using a script. If you want to write the code yourself read this tutorial:

    https://acrobatusers.com/tutorials/change_another_field

    If you don't feel like messing around with the code, you can use this tool that I developed to easily set up with the help of an input file:

    Scripts custom Adobe: Acrobat - fill the drop-down list

  • Automatically populate a drop-down list by using another selection from the drop-down list box

    New java/preparation forms so I apologize in advance.

    I currently have a menu drop-down box 1 (Occupation) with three options: "enter your own description/blank", retired housewife. When someone chooses either retirement or anyone at home, I would another drop box 2 (employer) to assign automatically "n/a. . The employer drop box has only two options: "enter your own/blank", N/A.

    Far, I could for that box to fill but only when the person clicks in the box (as if they were about to enter their own text.) Then only it will fill the drop-down list "employer." I would like it auto fill once the person has chosen retired, Virgin or stay-at-home woman without having to enter in the box (just using the arrow to the size of the drop-down list box).

    I currently have a key shot that resets the employer box when a person chooses the option vacuum/enter your own option. I then a JavaScript (only for the housewife now) that only works if you click the box of. Key combination works I want to than the other options work as well. If the client settles on white, the choice of the employer updates automatically empty without having to click in the box of. Any help (including general advice to make my code cleaner) is very appreciated!

    Current script of typing:

    If {(event.willCommit)

    If (event.value == "") this.resetForm (["use"]); of other SetFieldValues (event.value);

    }

    The current upward, mice running JavaScript :

    var v = this.getField ("Occupation") .value

    If (v is "Housewife")

    1. this.getField("Employer").value = "N/a".

    I think maybe I should use event.willCommit in my formula, but I'm not sure how to include it.

    Thank you!

    I would not use the key sequence or MouseUp actions for this, but the action post.

    Just make sure that you set the field option to validate the selected value immediately (under Properties - Options) and then use this code as the custom validation script:

    var employerField = this.getField("Employer");
    if (event.value=="Homemaker" || event.value=="Retired")
        employerField.value = "N/A";
    else employerField.value = employerField.defaultValue;
    
  • I have one drop-down list box where one selection (options) is the other.

    I have one drop-down list box where one selection (options) is the other. If a user selects the other, I want to conceive the possibility for them to enter some Notes to describe their other. A pop-up window or the text box is possible? Do not know how to approach the issue... Thank you!

    The field in parentheses is the text (or drop-down menu or other) you want to display when "Other" is selected and hide when it is not.

    If you want to apply the same logic to several fields just duplicate this line of code, the field name in each copy of setting.

  • A drop-down list can do the calculation based on the value selected in a drop down list?

    Form Acrobat X Pro Adobe

    Can I have a drop down list create a calculation based on the value selected in the menu drop-down?

    We have a set lunch and want the user to choose to be "A lunch', 'Lunch B'"C Lunch"or"just the milk. "

    It is for each of the 5 days of the week. There are therefore 5 drop downs, which have all the same 4 above choice.

    If the user chooses among the 3 lunches and then put $2.00 in the total box at the end of the line. If 'Just the milk' may put 0.50 in the box.

    The total area at the end of the line must keep a record of all 5 days and give a total.

    So if someone chooses lunch A LUN, sea and Sun and just milk for Tuesday and Thursday and then the total for this week must be $7,00

    Is it possible by using code or something?

    I did it in Excel, but we need it is an Adobe pdf file.

    TIA

    OK the total box has a 10 all the time to make it look like $ 2.00 for

    everything.

    Before even that I chose something there are 10 in the box.

    I am a newbie to Adobe scripting Total used VB/A .NET etc ' 1980

    However.

    Can you do any debugging in code?

    Initialize the sum

    var sum = 0;

    Make a loop on the drop-down list boxes and add the cost of the invoice sum

    for (var i = 1; i)< 6;="" i="" +="1)">

    Sum += getField("Week1Day"_+_i).value == 'just milk? 0.50: 2,00;

    }

    Set this field to the amount

    Event.Value = sum;

  • Have the drop-down list boxes become visible depending on the selection in a previous drop-down list box?

    Hi, im doing a form that only shows some options based on the previous selections.

    So far I have buttons which allow a user to select a specific product, and then by using the drop-down combo boxes select some optional features.

    I then have a simple javascript code that bears the name of a product at a price (i.e. the user selects product 'A', the review sections shows priced at $ 99).

    My problem is with additional customization options that depend on previous choices.

    Is it possible to have some drop-down list boxes become visible depending on the selection in a previous drop-down list box? If yes how could I impliment it?

    Currently my best idea is to have a button that could ask the user if he or she had previously chosen a certain selection and then reveal areas of correct drop-down list accordingly.

    Thank you

    Hello

    With a small change I think that the code works as expected. I changed your mainDD.value to event.value, as on the validate event the mainDD.value property cannot be updated as expected.

    script

    this.getField("Dropdown2").display = display.hidden;

    this.getField("Dropdown3").display = display.hidden;

    this.getField("Dropdown4").display = display.hidden;

    Switch (event.value)

    {

    case "a":

    this.getField("Dropdown2").display = display.visible;

    break;

    case "b":

    this.getField("Dropdown3").display = display.visible;

    break;

    case 'c ':

    this.getField("Dropdown4").display = display.visible;

    break;

    by default:

    break;

    }

    end of script

    Hope this helps

    Malcolm

  • Select the string table drop-down list box.

    Hi all

    I want to select the combo box list based on a string in the entry, I don't know how to do this. I have a drop-down list box and the value comes from a database, what I want to do is I want to change the value of the selected box based on the existing value in the database drop-down list. for example, A, B, C D I strings in the drop-down list box, and then in my database, I have a field with the string C, I want to change the C to A. I can't enter the value of C in a string format, but I don't know how to be the first position of the drop-down list box in so the order of channels combo box will be C, A, B, d., the value of C

    Thank you

    Then just write a new array of strings, with the elements of the new agenda, to the "[] strings" - property.

    Either you must code something that allows you to create an array of strings with the elements in the order that you want them to be. If there is a reorganization only, you could do something like:

    -Get the array of strings [] from the drop-down list using a property node box.

    -Find the position of the element you want to place first and use "delete from table", which returns the new array and the element removed.

    -Build a new table 1 d of the deleted item and table remaining. Move to the second combobox Strings [] property of a node property.

Maybe you are looking for

  • Finder is slow or unresponsive

    I have a huge problem with the Finder on my iMac (late 2012). Finder does not often respond very slowly. It looks like it all started there, maybe after the last update of El Capitan weeks. I use Finder in combination with iCloud (by car), may be cau

  • upgrading processor on 6200 pro

    The above 6200 Pro data sheet lists only "Sandy Bridge" 32nm lithography by 65/95 watt processors as an upgrade. Will be one of the 22nm lithography 'Ivy Bridge' more recent work of 55 watt CPU in MB.  Also the additional 30 watts in the quad core "S

  • Average displacement Subvi does not refresh the data in time real host VI

    Hello! I time real host VI that has evaluate the NI 9215 cRIO block data 9073. He takes analog data and calculates the phase shift. It works well with the connected equipment and displays the results. I need to get the moving average value of phase s

  • OfficeJet Pro K8600: Officejet Pro k8600 - cannot print

    Without warning, my printer does not print. It captures no paper. Error Msgs alternate between paper jam and load paper. I checked carefully for a paper jam and to blow off the dust, compressed air system. I tried online support - no help. Could not

  • HP Officejet Pro 8600 and default values of Open Office

    I bought this printer about 18 months ago and have used it several times to scan documents and convert them into editable text. Output to MS Word and was brilliant. I was recently required to install Open Office and since then, the printer ran out of