Hi Laserfiche Network,
I am working on Laserfiche Cloud and I am seeking a method to change the label of radio button choices using LFForm once a specific field event occurs. I have successfully changed form labels and field labels using "LFForm.changeFormSettings" and "LFForm.changeFieldSettings," but I am encountering difficulty in changing the labels of the radio button choices.
Below, you can see the code I am using to change labels. As mentioned, changes to the title and field label (including the radio button label) work, but not to the choice labels of the radio button.
For reference:
FieldId:1 is a Drop-Down field labeled "Language," which includes two choices: "English" and "Spanish."
Using LFForm.onFieldChanges, I would like to switch all the labels from English to Spanish and vice versa each time fieldID 1 changes.
FieldID:25 is one of the radio buttons of the quiz
I would appreciate it if you could review my code and provide some advice on how to achieve this.
Thank you in advance for your assistance.
Regards,
Miguel
// Code
LFForm.onFieldChange(function() {
if (LFForm.getFieldValues({ fieldId: 1 }) === 'English') {
LFForm.changeFormSettings({ title: "First Aid Quiz" }); // this line works
LFForm.changeFieldSettings({ fieldId: 25 }, { label: "1.Signs of a chest injury" }); // this line works too
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "1" }, { label: "Anxiety, and fear" }); //this line doesn´t work
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "2" }, { label: "A slow pulse" }); //this line doesn´t work
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "3" }, { label: "Painful breathing" }); //this line doesn´t work
} else {
LFForm.changeFormSettings({ title: "Prueba de Primeros Auxilios" }); // this line works
LFForm.changeFieldSettings({ fieldId: 25 }, { label: "1. Signos de lesión en el pecho" }); // this line works too
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "1"}, { label: "Ansiedad y miedo" }); //this line doesn´t work
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "2"}, { label: "Un pulso lento" }); //this line doesn´t work
LFForm.changeChoiceSettings({ fieldId: 25, choiceValue: "3" }, { label: "Respiración dolorosa" }); //this line doesn´t work
}
}, { fieldId: 1 });