Skip to main content

Is it possible to add the entries to CMS_INPUT_CHECKBOX dynamically ??

Comments

11 comments

  • Zendesk API User
    Author: felix_reinhold - 4/23/2019 10:27

    Hello,

    if it's okay for you to use an additional button as seen in your XML Snippet, then I'd replace the st_user dropdown by a CMS_INPUT_TEXT component and set editable to no. Then with the button you create a new form (see ShowFormDialogOperation) that contains a ComboBox that you create on the fly. It shows the users of the previously selected group. If there are only a few users per group then you can create the Entries of the ComboBox by writing the GOM-XML manually. If not, then I'd create another HotSpot that can receive the Group as PARAM.

    When the editor selects a user from the ComboBox and closes the dialog you can write the selected user to the CMS_INPUT_TEXT component. In addition you could add a hidden TEXT-Field that holds the loginname of the user if you need more information from the user-object then the display-name.

    Best regards

    Felix

    0
  • Zendesk API User
    Author: vasanth - 4/23/2019 11:59

    Hey Felix,

    Thank you for idea. So i plan to use the HotSpot as below But i have doubt how to get the param in MwfUserComponent ?? Do you have any idea ??

    /**

    *

    */

    package com.bosch.firstspirit.mwf.component;

    import java.util.List;

    import de.espirit.firstspirit.access.User;

    import de.espirit.firstspirit.access.store.templatestore.gom.GomIncludeValueProvider;

    import de.espirit.firstspirit.agency.SpecialistsBroker;

    public class MwfUserComponent implements GomIncludeValueProvider<User> {

    @Override

    public Class<User> getType() {

    // TODO Auto-generated method stub

    return User.class;

    }

    @Override

    public List<User> getValues(SpecialistsBroker paramSpecialistsBroker) {

    // TODO Auto-generated method stub

    return null;

    }

    @Override

    public String getKey(User user) {

    // TODO Auto-generated method stub

    return user.getLoginName();

    }

    }

    <CMS_INPUT_COMBOBOX name="st_group" hFill="yes" useLanguages="no">

        <CMS_INCLUDE_OPTIONS type="public">

          <LABELS>

            <LABEL lang="*">#item.name</LABEL>

          </LABELS>

          <NAME>MwfGroupComponent</NAME>

        </CMS_INCLUDE_OPTIONS>

        <LANGINFOS>

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

        </LANGINFOS>

      </CMS_INPUT_COMBOBOX>

        <CMS_INPUT_CHECKBOX name="st_user" hFill="yes" hidden="no" useLanguages="no">

        <CMS_INCLUDE_OPTIONS type=public>

        <NAME>MwfUserComponent</NAME>

        <PARAMS>

        <PARAM name="group">#field.st_group</PARAM>

        </PARAMS>

        <LANGINFOS>

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

        </LANGINFOS>

      </CMS_INPUT_CHECKBOX>

    0
  • Zendesk API User
    Author: felix_reinhold - 4/23/2019 13:02

    Your Hotstpot needs to implement the Parameterizable interface. But it can only work with String parameters. That's why you have to use the button as mentioned above. Pass the value of st_group to the script used in the button. In the script you build another form on the fly (ShowFormDialogOperation) and set the param of the Combobox in the GOM XML representation. The only option without a button would be sth. pretty experimental - e. g. you could create a ValueService that writes the value of st_group somewhere and you read that value in the hotspot. But I'm not sure if the values of the Combobox would be updated without a refresh of the form.

    0
  • Zendesk API User
    Author: vasanth - 4/24/2019 8:42

    felix.reinhold​ I am plan to use the Option 1 (on the fly form creation using ShowFormDialogOperation) But i have a doubt is that the value selected won't be persisted right (in the sense i need to choose the user every time) ?? and also how to access the user selection in the HTML channel of group form ??

    Is it possible to create  create the tabs dynamically (only once)

    0
  • Zendesk API User
    Author: felix_reinhold - 4/24/2019 9:06

    I think you got me wrong.

    Your form  will contain the Group-Combobox, a Button, a hidden textfield (for the user loginname) and a visible textfield with editable=no for th user display-name (Another option would be a combobox that uses the new UserHotspot with editabe=no instead of the two textfields).

    The button receives three parameters:

    • the group-combobox
    • both textfields

    The script that is assigned to the button creates a new form with the ShowFormDialogOperation.

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

        <CMS_INCLUDE_OPTIONS type="public">

          <LABELS>

            <LABEL lang="*">#item.name</LABEL>

          </LABELS>

          <NAME>MwfUserComponent</NAME>

          <PARAMS>

            <PARAM name="group">Value from group-combobox</PARAM>

          </PARAMS>

        </CMS_INCLUDE_OPTIONS>

        <LANGINFOS>

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

        </LANGINFOS>

      </CMS_INPUT_COMBOBOX>

    The script sets the value that the user selects to the provided textfields. Those textfields can be used as every other field in your template.

    0
  • Zendesk API User
    Author: vasanth - 4/26/2019 7:38

    felix.reinhold​ thank you for your suggestion. It seems to be a work around for me and what about creating a new FS component CMS_INPUT_TREE for this requirement and is that feasible ??

    0
  • Zendesk API User
    Author: felix_reinhold - 4/28/2019 19:37

    I think that this problem won't be solved by using CMS_INPUT_TREE because you also can't add the entries dynamically. based on another Combobox.

    0
  • Zendesk API User
    Author: vasanth - 4/29/2019 7:20

    felix.reinhold​ No, the CMS_INPUT_TREE will be static not no more combobox in the form. Because the tree structure will have everything

    0
  • Zendesk API User
    Author: felix_reinhold - 4/29/2019 8:32

    It should be possible like this, but keep in mind, that every user who is member of different groups appears multiple times in the tree.

    0
  • Zendesk API User
    Author: vasanth - 4/29/2019 9:16

    felix.reinhold​ do you any sample code to implement this ??

    0
  • Zendesk API User
    Author: felix_reinhold - 4/29/2019 9:41

    Sadly not, but take a look at the TNodeProvider

    0

Please sign in to leave a comment.