asked on May 21
A question came up on today's Champion Webinar to move the values of a Radio Button or Checkbox field to another Radio Button or Checkbox field later in the form. Here is the JS for Modern Designer to do this:
LFForm.onFieldChange(function() {
var value = LFForm.getFieldValues({ fieldId: YOUR FIELD ID });
LFForm.setFieldValues({ fieldId: YOUR FIELD ID RECEIVING VALUE }, value);
}, { fieldId: YOUR FIELD ID });
If you want to make the second field Read Only to force a match you can either use Show/Hide fields to disable the field when its not blank or use this script:
LFForm.onFieldChange(function() {
var value = LFForm.getFieldValues({ fieldId: YOUR FIELD ID });
LFForm.enableFields({ fieldId: YOUR FIELD ID RECEIVING VALUE }).then(function() {
LFForm.setFieldValues({ fieldId: YOUR FIELD ID RECEIVING VALUE }, value).then(function() {
LFForm.disableFields({ fieldId: YOUR FIELD ID RECEIVING VALUE });
});
});
}, { fieldId: YOUR FIELD ID });
8
0