- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Scripting: How to enable input compontent which is not editable by rules
Editors should only change the value of a CMS_INPU_LIST via a script rather than directly in the form. So I made this input not editable via rules. How can I make it editable via script to set the new values? I get the input field via the FS_BUTTON
thanks
// ??? make editable here
targets_inputlist_from_button.set(mappedTargetsNew); // set value here
// ??? make not editable here
<FS_BUTTON
name="fs_targetbutton"
hFill="no"
noBreak="no"
onClick="script:news_target_picker"
style="button"
useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Set news targets" description="TEXT"/>
<LANGINFO lang="DE" label="Nachrichtenziele zuweisen" description="TEXT"/>
</LANGINFOS>
<PARAMS>
<PARAM name="targets_inputlist_from_button">#field.cs_targetmapping</PARAM>
<PARAM name="editor_input_from_button">#field.cs_autor</PARAM>
</PARAMS>
</FS_BUTTON>
- Labels:
-
Developers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why don't you use a CMS_INPUT_CHECKBOX for this? Look into the rules demo project for inspirations..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps combine a CMS_INPUT_TOGGLE switched from the FS_BUTTON and a rule depending on the TOGGLE...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you want to make the list editable for editors to change it or simply set its value from within the script?
Cheers,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, simply set the value to the list field via script then. Why do you want to enable the UI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe there is another possibility to show the mapped datasets in the form instead of using this list?

