How to disable Sitecore Custom Submit Action OK button until mappings are chosen

468 Views Asked by At

Sitecore (9.3) I have created several custom Submit Actions and I noticed on one of the default ones, "Trigger Outcome", the ok button is disabled until the mappings are chosen.

Unchosen mappings

As soon as you choose the mappings, the 'ok' button is enabled.

chosen mappings

I tried setting the IsRequired checkbox on the item in SCRocks, but it only seems to make an asterisk* and not make it required/ok button disabled

property isRequired form element

I tracked down the toggle code to a file sourced from ~/speak/v1/components/ToggleButton.js, I think... but I am not really sure, it gets convoluted.

The JS files referenced for each of these default SA's have beefier code than the code used in the Sitecore Doc:

Walkthrough: Creating a custom submit action that updates contact details

Anyone go through this before? How to I accomplish this?

Thanks much.

2

There are 2 best solutions below

1
akshita_anand On

Yes, you can achieve this functionality by setting up some parameters for field names and conditions for ParentApp in your custom submit action js file.

0
Krithvik TRS On

This functionality could be achievable through below code in the speak JS file.

Check this out through bowser console window.
screen shot attached for the same
For enabling button parentApp.setSelectability(parentApp.pageCode,true)

For disabling button parentApp.setSelectability(parentApp.pageCode,false)

From TriggerOutcome.js check below line of JS code

initialized: function () {

                this.ItemTreeView.on("change:SelectedItem", this.changedSelectedItemId, this);
                this.CurrencyDropList.on("change:SelectedValue", this.changedSelectedItemId, this);

            },

changedSelectedItemId: function () {
                var isSelectable = this.ItemTreeView.SelectedItem.$templateId === outcomeTemplateId && this.CurrencyDropList.SelectedValue;
                parentApp.setSelectability(this, isSelectable, this.ItemTreeView.SelectedItemId);
            },

Hope you get clear idea. Thanks