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


#1

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


#2

Morning James,

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


#3

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


#4

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’)];


#5

Yes - that’s now done it - thanks!