web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Get the value from my radio button.

(1) ShareShare
ReportReport
Posted on by 26
Hello, 
 
I would assume this is a really simple things, but Ive been googling and searching and trying, and I cant manage to get the value from my radio button control (if there is an API somewhere where I can find this and more Id love a link). 
 
Ive made a form with a dialog pattern where I have the radio buttons populated from an enum, and then an okay/cancel button. When I press okay Id like to know what enum has been selected.
 
The best Ive been able to do at the moment is:
 
/info(int2Str(FormRadioButtonControl1.selection()));/
 
Which tells me what the number in the enum array it is. And I can probably use that (is there good way to get the actual enum value from the array number?), but I also assume there is a way to get the enum right away.
 
Another thing I noticed is that there are 4 values in my enum, and from my selection solution above the first one gives me 0, second 1, third 2, and the fourth give me 4. Why does it skip 3? Is this a problem, maybe selection is not doing what I think it is?
 
Thanks for help. 
I have the same question (0)
  • Verified answer
    Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Get the value from my radio button.
    Hi Dushatar,

    Regarding your 1st question, I think you should be able to get the enum value by using this:
    info(FormRadioButtonControl1.valueStr());

    ​​​​​​​and if you would like an enum object then
    Enum enum; //replace this with your enum value
    Info(strFmt("%1",str2Enum(enum, FormRadioButtonControl1.valueStr())));
    ​​​​​​​
    For the 2nd question: there is no issue but to understand why, is the enum you are using, has the property "IsExtensible" as false?  if yes, then look at the enum value for each one, maybe it's marked 0,1,2,4
    Here's what I mean:





    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Verified answer
    Martin Dráb Profile Picture
    237,697 Most Valuable Professional on at
    Get the value from my radio button.
    If the control is bound to a data source field, use the field directly, such as myTable.MyField.
     
    If it's an unbound control, use selection(), as you do, but assign the value to a variable with the type of your enum. For example:
    MyEnum selectedValue = FormRadioButtonControl1.selection();
    That the numeric values of enum elements aren't consecutive isn't a problem. You normally don't need to (or should) work with the numbers. You should use enum elements.
  • Dushatar Profile Picture
    26 on at
    Get the value from my radio button.
    Thank you Martin Dráb and Layan Jwei. Both your suggestions work.

    Ive tried to mark your replies as answers, but when I do the site just get stuck loading. Not sure if there is a problem at the moment or something weird on my side. Ill try again tomorrow. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans