Fragment Callback - returning a choice value instead of the choice ID

Hi, hopefully a quick question -

If I want to get the value of a selected choice field, what additional code should I use?
For example if ‘hr_reminder_type’ is a field path reference to a choice field:

var values = fragment_presenter.get_values();
if (!values) return;
var selection_id = mats.ref(‘hr_reminder_type’);
var reminder_type = values[selection_id];
fragment_presenter.set_value(reminder_type);

I’ll get the ID of the choice returned, rather than the value of that choice.

Many thanks,
James

Morning James,

Change to var reminder_type = values[mats.r(‘field_path’,‘hr_reminder_type’)];

Thanks Adam - I may be missing something but that line is still giving me the choice’s ID:

The choice will need the id and not the value.
Hower if you do need the value then:
var reminder_type = mats.displayable(‘hr_reminder_type’, values[mats.r(‘field_path’,‘hr_reminder_type’)];

1 Like

Yes - that’s now done it - thanks!