The features list states: "Adjustable slider widget that allows changing slider range dynamically". Examples does not contain an adjustable range example. How would I create this through code?

Lots of things were tried to get it working, this is what is currently there. Minrange and maxrange are the text fields, "edit-minrange" and "edit-maxrange" are the IDs given to the relevant field inputs. This was also tried with various different selectors (the field DIVs, static text, etc.) to no avail. BTW, tried removing the min and max values in the field definition, but no dice (it gets arbitrary values, 0~100). I also tried grouping them in a fieldset but no change. Here is what I have so far:

   $form['minrange'] = array(
    '#title' => t('Minrange'),
    '#type' => 'textfield',
    '#default_value' => '3',
    '#required' => TRUE,
    '#maxlength' => 128,
  );
 
      $form['maxrange'] = array(
    '#title' => t('Maxrange'),
    '#type' => 'textfield',
    '#default_value' => '8',
    '#required' => TRUE,
    '#maxlength' => 128,
  );
 
       $form['initialestimate'] = array(
    '#type' => 'slider',
    //'#orientation' => 'vertical',
    '#default_value' => array('value' => 5, 'value2' => 6),
    '#slider_style' => 'foo',
    '#range' => TRUE,
    '#min' => 0,
    '#max' => 10,
    '#step' => 1,
    '#adjust_field_min' => '#edit-minrange',
    '#adjust_field_max' => '#edit-maxrange',
    //'#required' => 1,
    //'#disabled' => TRUE,
    '#display_inputs' => TRUE,
    '#display_values' => TRUE,
    '#display_values_format' => '$%{value}%',
    '#slider_length' => '700px',
  );

Comments

sinasalek’s picture

Status: Active » Fixed

Fixed and new example added, You can try the latest dev snapshot

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sinasalek’s picture