Zum Hauptinhalt gehen

Werte aus CMS_INPUT_CHECKBOX lesen

Kommentare

5 Kommentare

  • Zendesk API User
    Author: mbergmann - 11/25/2015 13:57

    Hallo Dirk,

    mit dem GomFormElement biegst du in die falsche Richtung ab, das ist die "Definitionsseite" des Formulars.

    form1.get(null,"cs_filter_to_replace").get()

    liefert hier ein Set<Option> - und zwar bestehend nur aus den angehakten.

    Über das Set kannst Du iterieren, für jeweils eine Option kommst Du dann per

    option.getValue()

    an eine Entity.

    Viele Grüße

    Michael

    0
  • Zendesk API User
    Author: marza - 12/1/2015 14:13

    Hallo Dirk,

    benötigst Du noch weitere Hilfe oder haben Dir die Antworten von Michael bereits geholfen?

    In diesem Fall wäre es super, wenn Du die "richtige Antwort" entsprechend markierst, damit auch andere Community-Teilnehmer diese auf den ersten Blick finden. Solltest Du zwischenzeitlich eine eigene Lösung gefunden haben, wäre es nett, wenn Du diese hier bereitstellst.

    Viele Grüße

    Marian

    0
  • Zendesk API User
    Author: wiegele - 12/2/2015 10:15

    Hallo zusammen,

    nur der Vollständigkeit halber.

      StoreAgent storeAgent = context.requireSpecialist(StoreAgent.TYPE);

      ContentStoreRoot cs = storeAgent.getStore(Store.Type.CONTENTSTORE);

      TemplateStoreRoot ts = storeAgent.getStore(Store.Type.TEMPLATESTORE);

      Content2 csPressreleases = cs.getStoreElement("DeineDatenQuelle", Content2.UID_TYPE);

      FormData form1=context.showForm(false);

      Dataset dataSet = null;

      FormData data = null;

      FormField formFieldEntity =null;

      if(csPressreleases!=null && form1!=null){

      FormField filter = form1.get(null, "DeinCMS_InputCheckBox_EingabeFeld");

      Set<Option> valuesFilter = filter.get();

      for (Option opt : valuesFilter)

      {

      dataSet = csPressreleases.getDataset(opt.getValue());

      data = dataSet.getFormData();

      formFieldEntity = data.get(null, "cs_refName");

      //Ausgabe auf die Java Konsole

      print(formFieldEntity.get());

      }

      }

    0
  • Zendesk API User
    Author: rinku_chowdhury - 7/13/2018 13:45

    I am writing a script (FS v5) where I need to retrieve the value of the selected checkbox and do... but however, the aforementioned suggestions seem do not work in such scenario. Something is wrong with my approach. any clue, please?

    Form :

      <CMS_INPUT_CHECKBOX name="st_user" useLanguages="no">

        <ENTRIES>

          <ENTRY value="user 1">

            <LANGINFOS>

              <LANGINFO lang="*" label="name"/>

            </LANGINFOS>

          </ENTRY>

         <ENTRY value="user n">

            <LANGINFOS>

              <LANGINFO lang="*" label="name"/>

            </LANGINFOS>

          </ENTRY>

         </ENTRIES>

    </CMS_INPUT_CHECKBOX>

    script:

    FormData data= context.showForm();

    Set<option> users = data.get(null,"st_user").get();

    for(Option opt:users){

    JOptionPane.showMessageDialog(frame,"users: "+opt.getValue());

    }

    error:

    even with this statement : FormField filter = data.get (null, "st_user") throwing the same error.

    0
  • Zendesk API User
    Author: mbergmann - 7/13/2018 14:23

    Hello Rinku,

    as this question has been marked as "answered" and is more than three years old, you should normally open a new thread and link to this one.

    But maybe it is just a small typo - you use a small "O" in the line

    Set<option> users = data.get(null,"st_user").get();

    instead of a capital one ;-)

    Set<Option> users = data.get(null,"st_user").get();

    Oh, and do you have an import for "Option"?

    If that does not solve your problem, please open a new thread as "anwered" threads don't get that much attention.

    Michael

    0

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