cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
joehubbert
Level: Powered On

Using selected value of DropdownList in Function

Hi All, I'm having an issue with an app that I am creating with lots of form controls. I have created a function that sends an HTML email when the user clicks on a button. What I want is for the selected values of dropdownlists to be consumed in this function. When I use the syntax ddllist.selected it says it is an invalid argument. This is clearly incorrect and I wondered if you guys have a better way of achieving this task? Thanks! Joe
Microsoft Employee

Re: Using selected value of DropdownList in Function

Hello @joehubbert, First of all, can you please confirm if you're indeed using a DropDown control and not a ComboBox control? The ComboBox control is offered by default in forms. Please note that ComboBox.Selected property reference a record, not a field. You will have to add the field name there (example: ComboBox.Selected.Value).
joehubbert
Level: Powered On

Re: Using selected value of DropdownList in Function

Hi @dinusc, I am using a dropdown control rather than a combobox control. This is by design as these controls show fixed information such as countries/titles/nationalities

Microsoft Employee

Re: Using selected value of DropdownList in Function

Thank you for clarifying. I would still suggest to check if your DropDown.Selected returns a record rather than a field (this depends on the bound source). If you type a period after the "Selected" property, does Web Studio offer a list of field names to select from? Do you see any other errors besides the "Invalid Argument" when attempting to use DropDown.Sleected?

joehubbert
Level: Powered On

Re: Using selected value of DropdownList in Function

It does not return anything if I use the selected value. The datasource for these dropdownlists are hard coded for each individual dropdownlist rather than being bound to a datasource such as a SQL table. It doesn't five me a list of field names when I typoe a period after the selected property. It says it's expecting a Text/Number/Boolean value

Microsoft Employee

Re: Using selected value of DropdownList in Function

Could you please provide the hard coded data source the DropDown control is bound to?

joehubbert
Level: Powered On

Re: Using selected value of DropdownList in Function

Hi,

 

Here is an example of a dropdownlist used in the app:

 

Items=["Please Select",
"Afghan",
"Albanian",
"Algerian",
"American",
"Andorran",
"Angolan",
"Antiguans",
"Argentinean",
"Armenian",
"Australian",
"Austrian",
"Azerbaijani",
"Bahamian",
"Bahraini",
"Bangladeshi",
"Barbadian",
"Barbudans",
"Batswana",
"Belarusian",
"Belgian",
"Belizean",
"Beninese",
"Bhutanese",
"Bolivian",
"Bosnian",
"Brazilian",
"British",
"Bruneian",
"Bulgarian",
"Burkinabe",
"Burmese",
"Burundian",
"Cambodian",
"Cameroonian",
"Canadian",
"Cape Verdean",
"Central African",
"Chadian",
"Chilean",
"Chinese",
"Colombian",
"Comoran",
"Congolese",
"Costa Rican",
"Croatian",
"Cuban",
"Cypriot",
"Czech",
"Danish",
"Djibouti",
"Dominican",
"Dutch",
"East Timorese",
"Ecuadorean",
"Egyptian",
"Emirian",
"Equatorial Guinean",
"Eritrean",
"Estonian",
"Ethiopian",
"Fijian",
"Filipino",
"Finnish",
"French",
"Gabonese",
"Gambian",
"Georgian",
"German",
"Ghanaian",
"Greek",
"Grenadian",
"Guatemalan",
"Guinea-Bissauan",
"Guinean",
"Guyanese",
"Haitian",
"Herzegovinian",
"Honduran",
"Hungarian",
"I-Kiribati",
"Icelander",
"Indian",
"Indonesian",
"Iranian",
"Iraqi",
"Irish",
"Israeli",
"Italian",
"Ivorian",
"Jamaican",
"Japanese",
"Jordanian",
"Kazakhstani",
"Kenyan",
"Kittian and Nevisian",
"Kuwaiti",
"Kyrgyz",
"Laotian",
"Latvian",
"Lebanese",
"Liberian",
"Libyan",
"Liechtensteiner",
"Lithuanian",
"Luxembourger",
"Macedonian",
"Malagasy",
"Malawian",
"Malaysian",
"Maldivian",
"Malian",
"Maltese",
"Marshallese",
"Mauritanian",
"Mauritian",
"Mexican",
"Micronesian",
"Moldovan",
"Monacan",
"Mongolian",
"Moroccan",
"Mosotho",
"Motswana",
"Mozambican",
"Namibian",
"Nauruan",
"Nepalese",
"New Zealander",
"Ni-Vanuatu",
"Nicaraguan",
"Nigerian",
"Nigerien",
"North Korean",
"Northern Irish",
"Norwegian",
"Omani",
"Pakistani",
"Palauan",
"Panamanian",
"Papua New Guinean",
"Paraguayan",
"Peruvian",
"Polish",
"Portuguese",
"Qatari",
"Romanian",
"Russian",
"Rwandan",
"Saint Lucian",
"Salvadoran",
"Samoan",
"San Marinese",
"Sao Tomean",
"Saudi",
"Scottish",
"Senegalese",
"Serbian",
"Seychellois",
"Sierra Leonean",
"Singaporean",
"Slovakian",
"Slovenian",
"Solomon Islander",
"Somali",
"South African",
"South Korean",
"Spanish",
"Sri Lankan",
"Sudanese",
"Surinamer",
"Swazi",
"Swedish",
"Swiss",
"Syrian",
"Taiwanese",
"Tajik",
"Tanzanian",
"Thai",
"Togolese",
"Tongan",
"Trinidadian or Tobagonian",
"Tunisian",
"Turkish",
"Tuvaluan",
"Ugandan",
"Ukrainian",
"Uruguayan",
"Uzbekistani",
"Venezuelan",
"Vietnamese",
"Welsh",
"Yemenite",
"Zambian",
"Zimbabwean"]

 

Thanks,

Joe

 

 

Microsoft Employee

Re: Using selected value of DropdownList in Function

Thank you.

As previously suggested, the DropDown returns a record as the selected item, so you will have to indicate the field name. Here is the result of my test done with your test data set:Capture.PNG

 The DropDown control references a record. Since you provide hard coded values (that are not records), PowerApps implies one automatically (named Value).

Holpe this helps.

joehubbert
Level: Powered On

Re: Using selected value of DropdownList in Function

That seems to have worked! With the Office365.Sendmail function is it possible to control the HTML formatting to include h1, strong etc or is that not supported?

Microsoft Employee

Re: Using selected value of DropdownList in Function

You could provide the formatting options in your message body. FoorExample: "<H2>&MyMessage&</H2>"