Setting the Default Value for a Two Value Slider Control

Description

Setting the value for a two value slider

Discussion

Setting the Default Value at Design Time

You can specify the default value for a two value Slider Control at design time using the "x..y" syntax. For example, a slider with a range of 0 to 100 could be initialized to 30 and 70 by putting "30..70" in for the Default value property for the Slider Control:

images/2value_sliderdefault1.png
Setting the default value for a two value Slider Control at design time.

When you view the UX Component, the Slider Control will display the start and end values as 30 and 70:

images/2value_sliderdefault2.png
The Slider Control is defaulted to a start value of 30 and end value of 70.

Setting the Default Value at Run-time

A two value Slider Control's value can also be initialized dynamically. Let's assume you have a Slider Control that you have configured as a two value control with a range from 0 to 100. You may want to set the initial state dynamically when the initial values for the UX Component are computed. You can add some code to the onDialogInitialize server side event to emit Javascript that will set the Slider Control's value as follows:

dim js as c
js = <<%txt%
var s = {dialog.object}.getControl('MYSLIDER');
s.setValue([30,70]);
%txt%
e.javascript = js