cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
544
Views
0
Helpful
1
Replies

Is there any way to change settings dynamically based on other settings.

sreekanth47
Level 4
Level 4

Hi all, I'm creating a custom voice element, in which you can set some configurable data through settings. In my requirement, I've two settings like min digit and max digit, both are of type int. what I need to do is , the min digit value should be greater than 0, and max digit value should always greater than min digit, if the developer enter 0 for min digit, it automatically changes to 1, if the user enter 0 for max digit , it need to changed greater than min digit . Is this possible . the below are my actual settings

Setting[] settingArray = new Setting[2];

settingArray[0] =  new Setting(  MIN_DIGITS,  "MIN_DIGITS",  "MIN_DIGITS",  Setting.REQUIRED,  Setting.SINGLE,  Setting.SUBSTITUTION_ALLOWED,  Setting.INT); 

settingArray[1] =  new Setting(  MAX_DIGITS,  "MAX_DIGITS",  "MAX_DIGITS",  Setting.REQUIRED,  Setting.SINGLE,

  Setting.SUBSTITUTION_ALLOWED,  Setting.INT);

I used Dependency classes to achieve this,  for this  I added one more setting for min digit like

settingArray[2] =  new Setting(  "MIN_DIGITS_1",  "MIN_DIGITS",  "MIN_DIGITS",  Setting.REQUIRED,  Setting.SINGLE,  Setting.SUBSTITUTION_ALLOWED,  Setting.INT);

settingArray[2].setDefaultValue("1");

and dependencies are like this

Dependency d1 = new Dependency(settingArray[0].getRealName(), "0", 1);

Dependency[] minArr= { d1};

settingArray[2].setDependencies(minArr);

When I used  this code , if the user enters 0 for min digit setting, there is one more setting of name min digits with default value as 1 is added. How can I validate min digit and max digit settings.

1 Accepted Solution

Accepted Solutions

ewindgat
Level 5
Level 5

Unfortunately, they cannot be set dynamically.

View solution in original post

1 Reply 1

ewindgat
Level 5
Level 5

Unfortunately, they cannot be set dynamically.