Prepopulate the drop-down lists with xml file

Hello world

I'm trying to prepopulate a dropdown list using an xml file. There are many tutorials on the internet that allows me to do from the overview of the Designer tab. However, when I did it worked well, but I am not able to 'embed' the xml file so that the values appear in the workspace when the user starts a process.

I tried to load the xml file with the contents of resource reading in the action profile of the first task and put the result in the "xmlPrepareData" but the problem is that I can't put all the values of the xmlPrepareData after because the xml model is not exactly the one used by LiveCycle.

Any thoughts? Someone is already managed to prepopulate a dropdown list with an XML within the process?

Kind regards

Thomas

OK gr8...

Assuming you're able to get the XML process LC to your XDP/PDF form field.

You can fix the XML from the drop-down under-

clear the drop-down list box
* DROPDOWN_Field.clearItems ();

choiceList = XMLData.parse (* XML_Field.rawValue, false);

divide the choiceList in an array of values

choice = choiceList.resolveNodes("root.element[*].*NODENAME");

var numchoices = choices.length;

Adds an array of values in drop-down list
for (var i = 0; i)< numchoices;="">

{
* DROPDOWN_Field.addItem (choices.item (i) .value);
}

* DROPDOWN_Field - is your field drop-down list.

* XML_Field - is your XML data stored in a TextField.

* NODENAME - is the name of the node in your XML to solve.

I hope that Hepls...

Regards-

Chalukya.

Tags: Adobe LiveCycle

Similar Questions

  • Bind the drop down list to XML response from the web service

    In Designer ES2, I'm trying to populate a drop-down list with the data returned by a web service, but can't seem to get the link right.

    I created a web service using Workbench, which returns the following XML data (shown here in a text field for test purposes):

    image1.PNG

    However, when I bind this to the DataDropdownList control, LiveCycle seems to be putting the entire XML document in the drop-down list.

    Liaison:

    image2.PNG

    (Full text of the link is connectionData.groupLeaderWebService.Body.invokeResponse.xmlData.document.)

    Result:

    image3.PNG

    Therefore, a connection is made and the web service returns data, but it is not bound correctly as items in the list.

    I need the drop-down list to display the individual names returned by the web service.  Finally, it probably will be expanded to include the name and identification number (text and value, respectively).

    Can you see where I am going wrong with this?  Any help would be appreciated.

    Thank you!

    Toby

    Oops. Good fishing. This should be pls.loadXML (form1.page1.footer.lots.rawValue, 0, 1);

  • Automatic module in the drop-down list

    Is is possible to make a drop-down list to add a new element of list, every time someone entered something that is not already in the list?

    Thank you

    Josh

    • The script adds a "custom" name The names following the original crash. Is it possible to have the ability to add an unlimited number of additional items to the drop-down list?

    OK and I think v1.1 solves this problem. Testing, sorry, more tests can prove me wrong. The array must be initialized in the body of a function, otherwise, it gets recreated in each call to the script object. So I created a form (aka the global variable) variable to contain the initial data. With each release, event, I added a call to a function called checkData() that validates the entered value (either selected in the drop-down list or a custom text entry) does not exist.

    I am adding new values to the form variable and recreate the table of the form variable. This works very well for this use case, but I would discourage that adopting a form with several drop-down lists and/or a lot of data related to each dropdpown. You should really use data binding and put the processing on the server.

    Form1.Page1.Subform1.Dropdown1::exit - (JavaScript, client)

    If (! form1.page1.subform1.dropdown1.isNull) {}
    var str = form1.page1.subform1.dropdown1.rawValue;
    If (isNaN (str)) {}
    populateDropDowns.checkData (this);
    Form1.Page1.Subform1.dropdown2.clearItems ();
    Form1.Page1.Subform1.dropdown2.execInitialize ();
    }
    }

    Form1. #variables [0] .populateDropDowns - (JavaScript, client)

    stooge of var = new Array();

    function loadData (dropdownField) {}
    tenure = createArray();
    for (var i = 0; i)< stooge.length;="" i++)="">
    dropdownField.addItem (stooge [i]);
    }
    }

    function checkData (dropdownField) {}
    tenure = createArray();
    Check that the value is not in the table
    If (stooge.lastIndexOf (dropdownField.rawValue) ==-1) {}
    addData (dropdownField);
    }
    }

    function addData (dropdownField) {}
    var stoogeStr_ = stoogeStr.value;
    Check that the value is not in the global variable
    If (stoogeStr_.search(/dropdownField.rawValue/) ==-1) {}
    stoogeStr.value = stoogeStr.value + ', ' + dropdownField.rawValue;
    tenure = createArray();
    stooge.push (dropdownField.RawValue);
    dropdownField.clearItems ();
    loadData (dropdownField);
    }
    }

    function createArray() {}
    var stoogeStr_ = stoogeStr.value;
    tenure = stoogeStr_.split(",");
    return of foil;
    }

    • Because the initialization event again fills the drop-down list with the default Larry, Curly, Moe, the drop-down list loses 'tailor-made' entries on the reopening of the PDF file. Is there a way to save the final drop-down list, so that the options are there when the file is saved, closed and reopened its doors?

    This really requires a server solution or a rights compatible form that allows client-side XML import/export.

    Steve

  • Populating drop-down list with SQL

    I have a database and I want to fill the drop-down list with a 'Group By' request to show the various categories without showing many of the same.  Here's the code I'm having difficult with:

    DropDown {
                    id: filterSelect
                    visible: true
                    enabled: {if (purchaseValue != false){false}}
                    bottomPadding: 20
                    title: qsTr("Category:") + Retranslate.onLanguageChanged
                    horizontalAlignment: HorizontalAlignment.Center
                    options: Option {
                        id: allOption
                        text: qsTr("All") + Retranslate.onLanguageChanged
                        selected: true
                    }
                    onSelectedOptionChanged: {
                        if(filterSelect.selectedOption == allOption){
                        _app.refreshObjects()
                        }
                        else{
                        dataSource.query = "select * from items where categoryfield LIKE '%"+ filterSelect.selectedOption.text+"%'"}
                    }
                    attachedObjects: [
                        ComponentDefinition {
                            id: optionFactory
                            Option {
    
                            }
                        }
                    ]
                    onCreationCompleted: {
    //                    "select categoryfield from items group by categoryfield"
                        var newOption = optionFactory.createObject()
                        newOption.text = 'Text to add' // or a variable fetched from data source
                        //newOption.otherfields = ...
                        filterSelect.add(newOption);
                    }
                }
    

    I have a data source that fills the listview, I want to use the same database to populate the drop-down list.  How should I go about this?  I tried to configure a different DataSource {} just for the dropdown menu, but I couldn't make it work.  In bold text, I am not clear as where I incorporate my SQL query against the newOption.text =

    TL; DR I try to use a SQL query to fill my menu drop-down using the same PB that is used for the listview.

    Any help will be appreciated and thanked!

    A friend by the name of Roger Leblanc http://appworld.blackberry.com/webstore/vendor/70290/?lang=en&countrycode=CA helped me and created a small code example to explain how it works.

    import bb.cascades 1.2
    import bb.data 1.0
    
    Page {
        Container {
            DropDown {
                id: dropdown
            }
            ListView {
                id: myListView
                dataModel: dataModel
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.categoryfield
                        }
                    } // end of ListItemComponent
                ]
            } // end of ListView
        }
    
        attachedObjects: [
            GroupDataModel {
                id: dataModel
            },
            DataSource {
                id: dataSource
    
                // Load the data from an SQL database, based on a specific query
                source: "asset:///pinguin.db"
                query: "select categoryfield from items group by categoryfield"
    
                onDataLoaded: {
                    // After the data is loaded, insert it into the data model
                    // This will populate the ListView. You don't want to show
                    // categoryfield in ListView, I just wanted to show the difference
                    // between populating a ListView and a DropDown
                    dataModel.insertList(data);
    
                    // Now, this will populate the DropDown by iterating through every
                    // data from the query and adding it one by one to the DropDown
                    // using the optionFactory Component Definition to add dynamically
                    // new Options to the DropDown
                    for (var i = 0; i < data.length; ++i)
                    {
                        // Create new Option
                        var newOption = optionFactory.createObject()
    
                        // Set the Option text to categoryfield
                        newOption.text = data[i].categoryfield
    
                        // Add the Option to DropDown
                        dropdown.add(newOption);
                    }
                }
            },
            ComponentDefinition {
                id: optionFactory
                Option {}
            }
    // end of DataSource
        ]
    
        onCreationCompleted: {
            // After the root Page is created, direct the data source to start
            // loading data
            dataSource.load();
        }
    }
    
  • show/hide fields based on the drop-down list of choices

    I have a field from the drop-down list with three choices. Based on the selection, I need a specific text form field to appear and the others to stay hidden. (Or if it makes the code cleaner, the resulting field could be a drop-down list, too, with the selected choice.) I don't know Java well enough to extrapolate the code from the examples online and it fit my forms. I can provide an example of form. Thanks in advance for your help.

    There are ways to run this.  the easiest for you would be to add this script to the event (calculation of the Properties tab) to calculate the field that must be hidden.  Take notes, all "/ /" is some tips for you to understand the code.  You will need to put this script in all the areas you want to replicate the behavior, change the value depending on what you want to accomplish.  the word 'event' means myself to make you understand.

    If (this.getField("dropdown").value == 'put value here') {//replace "drop down" with the name of the drops}

    Event.Target.Display = display.visible;

    }

    else {}

    Event.Target.Display = display.hidden;

    }

    This works if you have a small amount of fields.  If you manage to have a large number of similar fields, let me know because there are other, faster ways.

  • Display all items or all files in the drop-DOWN list BOX

    Hello

    How to show the total files available in the drop-down list box by scrolling.

    In my project, I have to store the Daq measurement values in file.

    Later, I need to plot a graph since the values of a specified file.

    For this I need to select a file from the number of files.

    Give an idea or a sample program.

    Kind regards

    Hari

    Hi hari,.

    I couldn't open your vi I use Labview 8.5.

    See vi attached with this post.

  • Need help to parse the xml string to populate the drop-down list

    Here is my: problem

    I have a hidden text field that contains the text of an xml

    <>facilities
    < building >
    < name > Building A < / name >
    < name > building B < / name >
    < name > building C < / name >
    < name > building D < / name >
    < name > building E < / name >
    < name > building F < / name >
    < name > building G < / name >
    < name > building H < / name >
    < / build >
    < / facilities >

    My goal is to read this with JavaScript xml string to populate a drop-down list with values of element (name). Does anyone know how script that?

    Attached is a sample .xdp

    See you soon,.

    Jesse

    Here is an example of change. I put the code click on the button, so you can see it in operation... You can place this code in the event that makes sense for you. I also added another field to show the DOM (this is for debugging purposes and you can remove this field if you want).

    Paul

  • I have a drop down list with categories, how to close the categories?

    Hello

    I created the drop-down list categories and in each line, I'll choose a category in the menu dropdown.  How to add each category?

    It's the number 3.6.1 (2566), El Capitan

    That is to say.

    gas

    meal

    Rental

    I want to make the sum of all the lines that are "gas"?

    Use a drop-down menu the right way to do it?

    Thank you

    Edwin

    Hi Edwin,.

    Take a look at the personal Budget template in the template chooser > personal finance.

    SUMIF formulas are in the Budget sheet > summary by the table of categories > column C.

    The drop-down Menus (called context Menus in numbers) are in the leaf of Transactions > column C.

    Make sure spelling is accurate, or numbers will not find a match.

    Please call with questions.

    Kind regards

    Ian.

  • Don't want the previous file names being listed in the drop-down list the name of the file

    I have windows 8. Don't want the names of previous files are represented in the file name drop-down list in the page save money when saving a page on the net.

    Hi sliman,.

    1. which web browser you are using?

    If you are referring to Internet Explorer, the option to erase the file names when you save the Web page is not available. This feature is not provided because if the drop-down list does not display the file names already existing, you can eventually choose a file name that is already reflected in the previous file being overwritten and lost.

    For all windows questions do not hesitate to contact us and we will be happy to help you.

  • Populate drop-down list with the results of several drop-down lists

    Hi, I am creating a form where the results of two drop-down lists then would fill another drop-down list. I'm not new to javascript, but I'm new to using it in Acrobat, so while I found some answers to this: Drop-down list fill in multiple fields of text. I don't know where to implement this, if it is still the right thing, I'm looking for pipes for

    Oh and I use Acrobat Pro DC. Any help would be much appreciated!

    OK, you can create a function at the level of the document that is called in the Validate event of each of the two first drop down menus, something like:

    Function in JavaScript to the document level

    function updateDropdown() {}

    Get references to the drop-down menus of entry

    var F1 = getField ("DropdownList1");

    var F2 = getField ("DropdownList2");

    Refer to the output drop-down list

    F3 var = getField ("DropdownList3");

    Get the values of input field, as strings

    var s1 = event.target = f1? Event.value: f1.valueAsString;

    var s2 = event.target = f2? Event.value: f2.valueAsString;

    Fill the drop-down list of output with the elements, or deselect it if either input dropdown is 'empty' (single topic area)

    If (s1 = "" |) s2 === " ") {

    F3.clearItems ();

    } else {}

    F3.setItems (["", s1, s2]);

    }

    }

    In the two first downs Validate event, call this function like this:

    updateDropdown();

    You can of course name the function you want. More information about the properties and the methods used in the code are available in the Acrobat JavaScript documentation.

  • I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. How can I fix?

    I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. Can I fix?

    I am fairly new to this, but I think it has to do with the way you have drop them downs named. Copy you a then keep stick in each area? If so, that's the problem. You must rename each with a different number: Dropdown1, Dropdown2, etc. I think this might solve the problem.

  • Is this possible? Subforms appeal based on the drop-down list associated with the database

    I'm hoping to make a dynamic shape and I wonder if it's possible.

    I have a database with about 300 entries - pieces of agricultural goods and a few little bits of info on each of these properties. I want to create a form where users can choose the piece there rather than the property in a drop-down list. Based on the property they select, another menu drop down to fill with the cultures associated with this property. Then based on the selection made in this drop-down list, a specific form will be brought upward.

    For example, a person selects property #102 in the drop-down list. In the database, property #102 is associated with wheat, barley and corn, so the next drop would be complete with these three cultures. The user selects the wheat in the drop-down list and the form of wheat would be called. 

    I hope I explained that well enough.

    Is this possible? And if it's possible, how complicated to do? Assuming that I already have the database and subforms, it would be a long process from weeks to the script, or it would be simple enough?

    Yes, this could be done, here is an example that should help: Drop dependent dropdown (specimen attached)

    On the basis of selection (change event of the second menu drop-down), you can show or hide a subform.

    -Wasil

  • The drop-down list changes color with background option selected

    Hello!

    I m stuck with this drop-down menu that I need to have a red background, if the TBD option is active (which is the default) and have no backgrond if no other option is selected.

    drop01.png

    drop02.png

    drop03.png

    The red background is a red rectangle that is visible or hidden, I have all code in the event of modification of the drop-down list:

    if (this.rawValue == "TBD"){
        RectangleRed2.presence = "visible";
    }else{
        RectangleRed2.presence = "hidden";
    }
    

    But the thing is that the event checks the value when is changed, so if I'm in the value of TBD and I selected point 1, the recntagle is still visible, because at the moment, I have chosen point 1 value was to be determined, so does not in the way I need to.

    Anys ideas?

    Thank you!

    You must use

    if (xfa.event.newText == "TBD"){
    ...
    

    Then it works fine.

    "xfa.event.newText" evaluates to dropdown in the runtime.

    Hope it is useful,

    Mandy

  • Problem with the drop-down list related calculations

    Hi all

    I worked on a leave form using Adobe LiveCycle ES2 Design for more than three weeks. I am new to my work computer applications programming, and I've not had many world real experience with Javascript. My problem is that I have two drop-down lists in two separate subforms. I have a separate box for users to insert the number of hours of leave, they want to take next to each drop-down list. At the bottom of the form, I have a subform that I want to track the total number of hours for the type of leave, the users selected in the drop-down list.

    I tried several methods of JavaScript to FormCalc, but I succumbed to find a way to indicate each of my category of leave amounts to fields to reflect the value in field hours (this is... if the leave type list specifies the type of leave). I'm tired of scouring the Internet and books to see if I can find a viable solution to this subject. I have another issue to discuss with this same form regarding my case to add calculations, but he will have to wait until I am able to get this rectified issue. Can someone help me?

    Leave_Slip rough.png

    The script necessary to each calculation of total field.

    The only thing different between them, it's the '6' is changed for each category (i.e. personal leave is '0'). FormCalc select in the script editor. It really works in your form - guaranteed!

    Older var = _IndvSubForm.count

    var totHrs = 0

    for i = 1 to older don't

    If (IndvSubForm [i-1]. DataDropDownList2 == "6") then

    totHrs is totHrs + IndvSubForm [i-1]. TotalHours2

    continue

    on the other

    continue

    endif

    ENDFOR

    $ = totHrs

    Good luck

    Stephen

  • In the drop-down list to pull in file access

    HI -.

    I'm a beginner to this bear so please with me.  I know that have been discussed a hundred times but I can't seem to find someone else who is having this specific problem.

    I have v8.2.

    Given that my script was not working, I downloaded the document "Adobe LiveCycle Designer 7.0, providing research of the interactive database of forms" to try to see if I can understand what is happening.

    I built exactly as in the document except for the addition of 'clone (1)' as needed based on what I found in other messages on v8.2 and errors before.

    Drop-down list:

    / * This object listbox will fill two columns with data from a data connection.

    sDataConnectionName

    -the name of the data connection to get the data.

    -Note that the data connection appears in the data view.

    sColHiddenValue

    -It is the hidden value of listbox column.

    -Specify the name of the table column used for the fill.

    sColDisplayText

    -It is the column of the ListBox display text.

    -Specify the name of the table column used for the fill.

    These variables must be assigned for this script runs correctly.

    */

    var sDataConnectionName = "DataConnection;

    var sColHiddenValue = "ID";

    var sColDisplayText = "PART_NO."

    Search for sourceSet node that match the name of DataConnection

    var nIndex = 0;

    While (xfa.sourceSet.nodes.item (nIndex) .name! = sDataConnectionName)

    {

    nIndex ++;

    }

    oDB = xfa.sourceSet.nodes.item (nIndex) .racing var (1);

    oDB.open ();

    oDB.first ();

    Search with the command 'class name' node

    nIndex = 0;

    While (oDB.nodes.item (nIndex) .className! = 'command')

    {

    nIndex ++;

    }

    Define BOF and EOF to stay

    .query.recordSet.setAttribute ("stayBOF", "bofAction"), oDB.nodes.item (nIndex);

    .query.recordSet.setAttribute ("stayEOF", "eofAction"), oDB.nodes.item (nIndex);

    Find the record with the corresponding data connection name

    nIndex = 0;

    While (xfa.record.nodes.item (nIndex) .name! = sDataConnectionName)

    {

    nIndex ++;

    }

    var oRecord = xfa.record.nodes.item (nIndex);

    Find the value

    var oValueNode = null;

    var oTextNode = null;

    for (var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex ++)

    {

    If (oRecord.nodes.item (nColIndex) .name is sColHiddenValue)

    {

    o

    ValueNode = oRecord.nodes.item (nColIndex);

    }

    ElseIf (oRecord.nodes.item (nColIndex) .name == sColDisplayText)

    {

    o

    Node = oRecord.nodes.item (nColIndex);

    }

    }

    While (!) ODB. IsEOF())

    {

    this.addItem (oValueNode.value, oValueNode.value);

    IDList.addItem (oValueNode.value, oTextNode.value);

    oDB.next ();

    }

    Close connection

    oDB.close ();

    Button:

    If (Len (Ltrim (Rtrim (SelectField.rawValue))) > 0) then

    $sourceSet.DataConnection.clone (1). #command.query.commandType = "text".

    $sourceSet.DataConnection.clone (1). #command.query.select.nodes.item (0) .value = Concat ("Select * from OfficeSupplies where ID =", Ltrim (Rtrim (SelectField.rawValue)), "")

    Reopen the Dataconnection

    $sourceSet.DataConnection.clone (1) .open)

    endif

    Preview PDF and it connects OK, menu drop down fills properly, but when I click the button, it ALWAYS fills the data from the first record (no matter what is selected in the drop-down list).  It's the same problem I had with my own build.

    Anyone have any ideas of what I have wrong?

    Thank you!

    Misty

    The other thing, that I just noticed is that I usually clone the entire connection and not each node in the link that you have. Try changing your code for this:

    var nIndex = 0;
    While (xfa.sourceSet.nodes.item (nIndex) .name! = "DataConnection2")

    nIndex = nIndex + 1
    endwhile

    oDB = xfa.sourceSet.nodes.item (nIndex) .racing var (1); pertaining to the specified data connection node
    Configure sql call DB to get the details about MNR

    If (HasValue (SelectID)) then

    oDB.nodes.item (1).query.setAttribute ("text", "commandType");

    sqlString var = Concat ("SELECT * FROM drugs WHERE MRN = '", Ltrim (Rtrim (SelectID.rawValue)), "'")

    oDB.nodes.item (1).query.select.nodes.item (0) .value = sqlString.

    now connect to the DB and get a recording
    oDB.open)
    oDB.close ();

    endif

    Also if you copy and paste code quotes always get screwed up... .you will have to type.

    Paul

Maybe you are looking for