Developer forum

Forum » Swift » Issue with getting radio box values

Issue with getting radio box values

Daniel Voicu
Daniel Voicu
Reply

Hello,

I'm having issues getting the values from the product whenever the values are not string. In my configuration, the value that I'm trying to output is a collection of radio boxes. I'm attaching screenshots of how the values are displayed in the interface and what tags we used to output the value. The type of the value is Object but there are no other methods to use on it to get the value we need.

 

Screenshot_2022-02-11_122142.png Screenshot_2022-02-11_122341.png Screenshot_2022-02-11_122455.png

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

The value is a list of FieldOptionValueViewmodel so just cast to that type and then iterate the collection.

 

Votes for this answer: 1
 
Daniel Voicu
Daniel Voicu
Reply

Thank you. I've solved this internally with this solution. Is this what you meant?

List<FieldOptionValueViewModel> fieldList = (List<FieldOptionValueViewModel>)fields.Value;
var field = fieldList.FirstOrDefault() != null ? fieldList.FirstOrDefault().Value.ToString() : "";

 

 
Nicolai Pedersen
Reply

Yeah, not pretty but it works.

 

You must be logged in to post in the forum