Expand my Community achievements bar.

SOLVED

Help with Listeners

Avatar

Level 3

HI,

I have 5 widgets in a tab.
1. checkbox
2. radio
3. textfield
4. pathfield
5. multifield

if you check 1, the 4 below will be disabled, if unchecked , the 4 below will b enabled
if 1st option(link) of the radio is selected , the multifield will be disabled, if 2nd(dropdown) is selected, the pathfield will be disabled

Below are the listeners i initially implemented

Listener for checkbox

 

selectionchanged :

function(box,value,isChecked) {

    var dlg = box.findParentByType("dialog");

    var radio = dlg.findById("dropdownToggle1");

                var textfield = dlg.findById("pimaryNavigationButtonText1");

                var pathfield = dlg.findById("primaryNavigationButtonLink1");

                var multifield = dlg.findById("navigationSection1");

               

    isChecked ? radio.disable() : radio.enable();

                isChecked ? textfield.disable() : textfield.enable();

                isChecked ? pathfield.disable() : pathfield.enable();

                isChecked ? multifield.disable() : multifield.enable();

}

 

 

Radio listener

 

selectionchanged:

function(box,value) {

    var dlg = box.findParentByType("dialog");

    var pathfield = dlg.findById("primaryNavigationButtonLink1");

                var multifield = dlg.findById("navigationSection1");             

                if(value=='link'){

                                pathfield.enable();

                                multifield.disable();

                }

                else{

                                pathfield.disable();

                                multifield.enable();

                }

}

 

The problem is that after authoring the fields, when you next change the selection of checkbox, all the four fields are enabled and not the fields according to the radio listener.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I think, that is because you are enabling both pathfield and multifield on the checkbox selection change.

Actually, pathfield and multifield should be controlled on the radio field and it should not be in checkbox selectionChange. If you remove there, it should work.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

I think, that is because you are enabling both pathfield and multifield on the checkbox selection change.

Actually, pathfield and multifield should be controlled on the radio field and it should not be in checkbox selectionChange. If you remove there, it should work.