Contact API - results subscription to drop-down list

I currently use the code below to get all available phone numbers and e-mail addresses for a contact:

QVariantList ApplicationUI::getPhoneNumber(int contactId)
{
    ContactService *contactService = new ContactService();
    Contact contactInfo = contactService->contactDetails(contactId);
    QList numberList = contactInfo.phoneNumbers();
    QVariantList no_s;
    int length = numberList.size();

    for (int i = 0; i < length; i++) {
        no_s << numberList.at(i).value();
    }
    return no_s;
}

QVariantList ApplicationUI::getEmailAddress(int contactId)
{
    ContactService *contactService = new ContactService();
    Contact contactInfo = contactService->contactDetails(contactId);
    QList emailList = contactInfo.emails();
    QVariantList no_s;
    int length = emailList.size();

    for (int i = 0; i < length; i++) {
        no_s << emailList.at(i).value();
    }
    return no_s;
}
ContactPicker {
            id: contactPicker
            onContactSelected: {
                contactPhoto.imageSource = _app.getContactPhoto(contactId)
                if (contactPhoto.imageSource == "") {
                    contactPhoto.imageSource = "asset:///IMG/user_placeholder_blue.png"
                }
                firstName.text = _app.getFirstName(contactId)
                surname.text = _app.getSurname(contactId)
                phoneNumber.text = _app.getPhoneNumber(contactId).toString()
                emailAddress.text = _app.getEmailAddress(contactId).toString()
            }
        }

However, this feature is out just now all the available phone numbers and email addresses - for contact - to a text field, but I was wondering if it would be possible to output the list of individual options in a drop-down list instead of just their output in a text field?

You will need to use ComponentDefinition and dynamically create each Option.

Here is a code to do this:

/*
 * Copyright (c) 2011-2014 BlackBerry Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import bb.cascades 1.2

Page {
    Container {
        DropDown {
            id: dropDown
        }
        Button {
            onClicked: {
                // Remove all options from DropDown
                dropDown.removeAll()

                // Create a VariantList to mimic a list of number returned by your C++ function
                var listOfPhoneNumber = new Array()
                for (var i = 0; i < 10; i++) {
                    var randomNumer = Number((Math.random() * 9000) + 1000).toFixed(0)
                    var phoneNumber = "1-555-666-" + randomNumer.toString()
                    listOfPhoneNumber[i] = phoneNumber
                }
                console.log("listOfPhoneNumber: " + listOfPhoneNumber)

                // Iterate the list of number and add them to DropDown
                for (var i = 0; i < listOfPhoneNumber.length; i++) {
                    var newOption = emptyOption.createObject()
                    newOption.text = listOfPhoneNumber[i]
                    dropDown.add(newOption)
                }
            }
        }
        attachedObjects: [
            ComponentDefinition {
                id: emptyOption
                Option {}
            }
        ]
    }
}

Tags: BlackBerry Developers

Similar Questions

  • How to call a taskflow based on results from the drop-down list. ?

    Hello

    I want to call a taskflow based on the results of the drop-down list, I have a drop down list with LOV, if I choose a value insofar as it must call the taskflow are entrusted to him. How to do this. ?. How to assign a taskflow for all values and how to call it. Someone please help...

    Page:

    http://Java.Sun.com/JSP/page"version ="2.1 ".

    xmlns:af ="http://xmlns.oracle.com/adf/faces/rich" >. "

    valuePassThru = 'true '.

    valueChangeListener = "#{SelectBean.onSelection}" > "

    Main.XML (TaskFlow);

    http://xmlns.Oracle.com/ADF/controller"version ="1.2">

    Choose

    Choose.JSFF

    /Web-INF/FirstTF.XML

    FirstTF

    /Web-INF/SecondTaskFlow.XML

    SecondTaskFlow

    Choose

    First

    FirstTF

    Second

    SecondTaskFlow

    Code VlaueChange Listner already told you.

    First and second pages only contain output text component in my example. I think that is not necessary

    Concerning

    Vincent

  • 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.

  • Creation of calculation based on the result of the drop-down list

    Hello. I hope that someone will be kind enough to help me with some Javascript because it seems that I am too blonde and middle ages to figure out by myself.

    I have a drop-down list box 'Member '. The Yes value is 0. The value is 10.

    Then I have three check boxes. "Day 1" value is 35. "Day2" value is 25. 'Dinner' value is 65.

    If this option is enabled, I want the sum of the check boxes, if they are checked. (for example, total if all checked = 125)

    If no is selected, the value of each check box rose 10. (for example, total if all checked = 155)

    I use Acrobat X.

    Thanks in advance.

    Due to the fact that you want to add a constant number of values if a given condition is met then you will need to use a custom calculation script.

    get the value of the fields

    var cMember = Number (this.getField("Member").value);

    var nDay1 = this.getField("Day1").value;

    var nDay2 = this.getField("Day2").value;

    var nDinner = this.getField("Dinner").value;

    define a varaiable for the sum

    var sum = 0;

    day 1 more SETTINGS

    If (nDay1! = "Off") the sum += (nDay1) Number + cMember;

    day 2 more SETTINGS

    If (Day2! = "Off") the sum += (nDay2) Number + cMember;

    more dinner SETTINGS

    If (nDinner! = "Off") the sum += (nDinner) Number + cMember;

    Event.Value = sum;

    Excel is easy if you would see Microsoft calculations.

  • How can I make a subform that is contingent on the results of the drop-down list?

    I have a drop-down list. I also have a subform. If you select 'A', I want the subform to appear.  If you select 'B', I don't want the subform to appear.  I use Adobe Livecycle Designer 8.0.  I'm in the right forum?

    Hello

    I have a little code to youre cahnged. You used wrong variable in the condition condition, I changed it to correct.

    Now it's working.

    See attach.

    BR

  • Make a field of text/hide according to the results of a drop-down list box

    Hello

    I wonder if someone could help me with this. I want to show/hide some text boxes in my form according to the choice made by the person filling in. For example, there is a dropdown list containing a selection of numbers 1-4. If 1 was selected, the text boxes below 1 would be visible and obligatory, if the 2 have been chosen, 2 text boxes below would be visible and required etc...

    I'm new to FormCalc (only started using it this morning), so simple a possible explanation would be fantastic.

    Thanks for reading!

    Of course, you can have javascript and formcalc in the form. Not only the two in the same field, same event; D

    Okey, let's try some things:

    (1) check if the "binding" from the drop-down list is the same as the values that you choose. In the script you are referring to the bound values.

    (2) other names for the Textfields would be better, because it is more difficult to refer to "Textfield1 [1]" then to for example: 'New '. I was just to lazy to give them names. (If it's on another page or subform, you refer to the fields correctly: as MyForm.FirstSubform.FirstTextfield... this name lies in the specific script field.)

    (3) check your script once more... want to make invisible mandatory fields?

    (4) check if your form is dynamic. (If it isn't you will not see the changes...)

    You should probably do it in small steps, such as:

    (1) first of all, you refer to areas such as:

    This.rawValue = Firstfield.rawValue;

    If the changed value fields got you its name and to be sure that the event you put is the right one.

    (2) try the different parts of the script and look at how it works. Problems can be more easily found and then

  • How to remove a contact from the drop-down list?

    How to remove a contact when, if forwarding a message, the icon flashes in space 'To' to enter the email address, when you press the first letter of a recipient, it displays a list of previous names/addresses used. This can add to a huge list! Most of the time, it is useful, but how can I shorten the list by removing unwanted contacts in the drop-down list? I got them removed from my address book/contacts (and they are deleted) but even after re-booting the computer, their names still appear in the drop-down list as before. All solutions?

    Instead of typing the first letter of the name of the recipient

    Press on the envelope icon to next to the box where you type the name of the recipient

    Opens the selection of recipients

    Highlight the recipient of choice

    Click on the button to

    The name appears in the window of the recipient of the Message

    Windows CC and British Colombia should remain virgins

    Press Ok

    The name of recipients appears in the field to the message

  • mysterious e-mail addresses appeared in my touch menu drop-down list but no Contacts. How can I delete?

    Unknown contact group appears at the bottom of the drop-down list when you click on the button 'to '. These group names are not in my contacts list, so can't edit them... I can't remove this element from the drop-down list. How can I remove them?  Thank you.

    Hotmail questions need to be asked here: http://windowslivehelp.com/product.aspx?productid=1.  Can't help the people in these forums.  You could also ask your question on Hotmail Facebook page at https://www.facebook.com/Hotmail.  Sometimes the messages in a very public place get more attention.

  • Contacts drop-down list in new email Outlook 2007

    When I open a new email and click on the: type a letter in the name I want a drop-down list appears.  This list is added whenever I get a new email address.  I found that it is not connected to the contacts folder. How can I remove the names from this list.
    How to activate the small book icon left of the Word address to: and CC:

    I have windows XP with Office 2003, which had presented the program of upgrading compatibility added.  This problem has been most always good there.
    Help, please

    Hello

    To remove these name, you highlight (Type the first character and press the arrow down) the name falling down and press Delete on the keyboard, it will remove the name of the cache.

    If you want to remove / clear the entire list, you need to delete *.nk2 file in your C:\Documents and Settings\change

    I hope this helps.

  • Erase contacts from Windows mail in the drop-down list.

    I am ready to send my email. I type the first letter of the 'c' reception A box goes down with four different recipes that begin with 'c '. How can I delete the ones I don't want from the drop-down list? I removed them from the list of contacts, but they always appear in the drop-down list.

    Thanks in advance for any help!

    Jim

    How to delete registration completion email in Windows Mail
    http://www.Winhelponline.com/articles/245/1/how-to-clear-the-email-auto-complete-entries-in-Windows-mail.html Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • Affect results column Drop Down, list of values


    Interactive reporting vs Hyperion 9

    I have a drop down filter that I use in a dashboard report. Works very well.  I have no problem creating drop-down filter when the list of values are typed by me by hand. As the year 2013, 2012, 2011, 2010.  Or region, North, South, East or West.  But what happens if I want to filter by customer name?  We have hundreds of customers in the table.  In addition, accounts receivable change daily.  How can I get the drop down to view the customers? In consideration of the separate alphbetically, sorted?  It would be extremely useful to my users to have the ability to produce sales for a particular client activity... in fact, essential.  How to configure the drop-down list?

    have you tried the code with a button first?  Doing a job?

    If you used the code above there are two small errors in there

    for (var i = 1; i)< arr.length;="" i++)="">

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i - 1]);

    }

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i]);

    should be

    for (var i = 1; i)< arr.length;="" i++)="">

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i - 1]);

    }

    If (arr [i - 1]! = arr [i]) oDrp. Add (arr [i]);

    Please copy - paste your code here.

  • Prepopulate the resulting drop-down list of selections in other areas

    I wonder if anyone can help?

    A form with radio buttons group containing two boxes 'Yes' and «»

    The radio buttons here's a drop-down list that has three items in the list "option A, option B and option C.

    That, here's another drop-down list, with three points, "10000", "15000" & "20000".

    How can I do the following?

    What radio button 'Yes' is selected and the drop-down list "option A is selected, it prepopulates what"10000"in the drop-down list below.

    What radio button 'Yes' is selected and the drop-down list "option B is selected, it prepopulates what"15000"in the drop-down list below.

    What radio button 'Yes' is selected and the drop-down list "C is selected, it prepopulates what"20000"in the drop-down list below.

    Thanks in advance!

    See the pdf attached here: http://groups.google.com/group/livecycle/web/DropDown.pdf

    Is this what you need?

    Nith

  • Unable to choose in the drop-down list

    I don't know what his name, so I'll give an example. I go on YouTube and open my subscriptions & playlist. I push the tab more, and I can see my other titles of the playlist. When I try to type on one of the titles, the option button close. I can not open & take an option on a website. If I have the chance and I was fast enough to push an option before the box closes it will open the file or the site without problem. I tried double tapping on the option button to keep it open, but it never works. Anyone know how to fix this?

    Hello

    Thanks for posting on the Microsoft community.

    If I have understood correctly, you are unable to choose an option in the drop-down list.

    If you have another browser option, I suggest that you try to open the particular website on this browser and see if it works.

    Please perform the following methods to resolve the problem, if you use Internet Explorer as your browser:

    Method 1:

    This can be caused because of compatibility problems with the Web site. Then I suggest that you try to open the Web site in compatibility mode.

    Check out the following link to open a website in compatibility mode:

    http://Windows.Microsoft.com/en-us/Internet-Explorer/use-compatibility-view#IE=ie-11

    If this does not work, try Method 2.

    Method 2:

    Try resetting Internet Explorer.

    Note: By resetting Internet Explorer settings, return you it to the State wherever it was when it was first installed on your computer. This is useful to solve the problems that could be caused by the settings that have been changed after installation.

    Warning: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings. Also re - activate the Add-ons.

    Check out the following link and follow the steps to reset Internet Explorer:

    http://support.Microsoft.com/kb/923737

    I hope this helps. Feel free to answer us back with the results.

  • Web site works not-selection drop-down list box does not correctly

    Http://mobile.free.fr/moncompte -commerce site
    A drop-down list box shows that the user can choice phone numbers.
    The result is always a warning message 'phoe number still used '.
    FireFox version: 29.0.1
    plugin: WOT, ADBLOCK +.
    Best regards

    Many issues of the site can be caused by corrupted cookies or cache.

    • Clear the Cache

    Press < Alt > or < F10 > to display the toolbar. Then;
    Tools > Options > advanced > network > content caching Web: clear now

    and

    • Delete Cookies

    Press < Alt > or < F10 > to display the toolbar. Then Tools > Options > privacy.

    Under historical, select Firefox will use the custom settings.
    There is a button on the right side, called View the Cookies.

    If there is still a problem,
    Start Firefox in Safe Mode {web link}
    While you are in safe mode;
    Press the < Alt > or < F10 > key to bring up the toolbar... Then
    Tools > Options > advanced > general.
    Find and stop using hardware acceleration.

    Dig safe web sites and see if there is still a problem. Then restart

  • Dynamic drop-down list in the Bay of cluster

    I have a table of cluster that contains two drop-down list boxes. The first drop-down list box control which Articles of the second drop-down list box by writing in the node property [StringsAndValues] for the second box. The problem I have is when I create a new index in the table of cluster and select different values in the drop-down list boxes, it changes the area of dynamic drop-down list on all indexes in the table. Attached, that's what I have so far.

    Thank you

    Chris

    Wow, what are the chances of another thread like this so early.

    Check out this other thread and look at the link of Hooovahh to see a great way to change the drop-down list box strings during execution to give the appearance different drop-down list boxes. The reality is that you can't have the combo box different types/lists in the same table. So what it is, is to check what element you are clicked on and change the behavior of the combobox as a result.

Maybe you are looking for

  • For some reason any time Firefox responds incorrecty to some essential features.

    The details are that Firefox works perfectly and without any reason, I am unable to determine [shift-2] would become so instead of ' and [shift + '] becomes "instead of @.". "The problem is that in Firefox, as all other software continue to produce t

  • Satellite L300D-11 a - do not start Windows vista

    Hello When I turn on my computer, I get the following error message: Error recovery for Windows Windows cannot start up. A change of equipment or software that has been recently achieved may be the cause. If the windows files are damaged or misconfig

  • (EN) / (РУС) BOOTCAMP + EL CAPITAN DISK UTILITY = BOOTCAMP NOT LOAD

    Sorry myEnglish is bad EN(1) install BOOTCAMP on maverics (2) up to Yosemite > EL CAPITAN (3) the right of al (4) I wanted more space on bootcamp (5) I want: (I create disk of 10 GB EXfat > kill discs EXfat on windos and extendet bootcamp) (6) after

  • differential vs nrse on ground referenced signals

    Is there a difference in terms of noise rejection during the use of a differential input adc on an analog input, where an entry is on the ground, vs. nrse where we refer to the ground on a PIN? IM using a usb-6218

  • Upgrade of CUP CQ57-339WM

    1. number and product nameUpgrade of CUP CQ57-339WM 2 operating system installed (if applicable)Windows 7 Edition home premium 3. error message (if any)None 4. all changes made to your system until the problem occurredNO. MY QUESTION: I was wondering