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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unfortunately, they cannot be set dynamically.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments
0 comments
Please sign in to leave a comment.