Created a new form element to use a slider control, using the s/p ajax module + scriptaculous library. Works beautifully, however I'm not getting a return value back that is storable. Anyone who has created a new form element able to shed some light on this for me?
<?php
/**
* Custom form element to do an ajax slider
*/
function testimonials_elements() {
$vals = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
$options1 = array(
'#range' => '$R(0,20)',
'#minimum' => 0,
'#maximum' => 20,
'#increment' => 1,
'#values' => $vals,
'#onSlide' => "function(v){\$('debug1').innerHTML='slide: '+v; $('barreSortie4').style.width=(v*3)+'px';}",
'#onChange' => "function(v){\$('debug1').innerHTML='changed! '+v}",
);
$type['sliderA'] = array('#input' => TRUE, '#process' => spajax_slider('handle1', 'track1', $options1));
return $type;
}
function theme_sliderA($element) {
//see CSS for style defs for track1, handle1, debug1
$output = '
'.$element['#title'].'
';
$output .= '
';
$output .= '
';
return $output;
}
... in hook_form()
//slider control for form
$form['review']['satisfaction'] = array(
'#type' => 'sliderA',
'#title' => t('Overall satisfaction with your results'),
'#default_value' => $node->satisfaction,
);