Help with Listeners | Community
Skip to main content
Har_Khandelwal
Level 2
October 16, 2015
Solved

Help with Listeners

  • October 16, 2015
  • 1 reply
  • 1179 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

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.

1 reply

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 2015

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.