Zum Hauptinhalt gehen

Working with cms_input_list trough FS API

Kommentare

2 Kommentare

  • Zendesk API User
    Author: mbergmann - 2/9/2023 17:37

    Hi,

    when dealing with option based input components, you can just set an „appropriate value“ to the FormField. E.g. if it’s based on String (like it is when using <entries>), the following should work:

    targetDataset = targetContent.getDataset(targetEntity);
    targetData = targetDataset.getFormData();
    targetData.get(language, "dtMandant").set(Collections.singleton("faculty_02"));
    //of course, after setting all the other fields, I save it all
    targetDataset.setFormData(targetData);
    targetDataset.save();

    For other cases, i.e. when the INPUT_LIST is based on database entries you could simply use a Collection of Datasets or Entities in the FormField‘s .set(…) method.

    The same applies to INPUT_CHECKBOX, INPUT_RADIOBUTTON and INPUT_COMBOBOX by the way - for the latter two, you don’t need a Collection of course but just the value itself.

    Hope this helps!

    Michael

    0
  • Zendesk API User
    Author: civca - 2/13/2023 8:15

    thank you man, you helped me a lot.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.