Skip to main content

Scripting: How to enable input compontent which is not editable by rules

Comments

9 comments

  • Zendesk API User
    Author: Peter_Jodeleit - 6/13/2014 10:47

    Why don't you use a CMS_INPUT_CHECKBOX for this? Look into the rules demo project for inspirations..

    0
  • Zendesk API User
    Author: Karsten - 6/13/2014 12:59

    No! I need to do it this way and I need to know the code to make this CMS_INPUT_LIST editable from within my script please.

    0
  • Zendesk API User
    Author: Peter_Jodeleit - 6/13/2014 14:41

    Perhaps combine a CMS_INPUT_TOGGLE switched from the FS_BUTTON and a rule depending on the TOGGLE...

    0
  • Zendesk API User
    Author: StefanSchulz - 6/16/2014 6:49

    Do you want to make the list editable for editors to change it or simply set its value from within the script?

    Cheers,

    Stefan

    0
  • Zendesk API User
    Author: Karsten - 6/16/2014 8:08

    Hi,

    the list is changed by the script I run with the button. Nevertheless the editor should be able to see the mapped values but not to change them directly.

    I tried a second list which maps on the same column just to show the selected values but on save these values overwrite the new selections made via the button. And the system warned that a field is mapped twice which can cause this behaviour. so I need a way around this issue.  Thanks

    0
  • Zendesk API User
    Author: StefanSchulz - 6/16/2014 8:24

    Well, simply set the value to the list field via script then. Why do you want to enable the UI?

    0
  • Zendesk API User
    Author: Karsten - 6/16/2014 9:18

    because otherwhise i get an exception that the field is not editable.

    if(formData != null) {

            datasetFormData = element.getFormData();

           

            //get selected gui value

            selectedValuesNew = formData.get(null,"cs_target").get(); //set

           

            // Update selected targets

            Set<Option> mappedTargetsNew = new HashSet<Option>();

            for(value:selectedValuesNew){

                    mappedTargetsNew.add(optionModel.getOption(value.toString()));

            }

           

            // Insert previously selected hidden options (Editor has not right to alter all options but they must be kept)

            mappedTargetsNew.addAll(hiddenMappedTargets);

           

            // Update element in the form   

            targets_inputlist_from_button.set(mappedTargetsNew);

                   

        }

    0
  • Zendesk API User
    Author: StefanSchulz - 6/16/2014 9:24

    What version are we talking about?

    Please, post or attach the exception or report it to the help desk. Rule-based disabling is not meant to disable API use.

    Cheers,

    Stefan

    0
  • Zendesk API User
    Author: Karsten - 6/16/2014 12:49

    Maybe there is another possibility to show the mapped datasets in the form instead of using this list?

    0

Please sign in to leave a comment.