Permalink
Browse files

added event change trigger for hidden form input

  • Loading branch information...
1 parent 1573d43 commit 9c78e40a1c9b18ed44e13a8d09fdddd114246620 somatonic committed Feb 20, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 InputfieldRangeSlider.module
@@ -66,6 +66,8 @@ class InputfieldRangeSlider extends Inputfield {
$constrain = "$( '#Inputfield_{$this->name}1' ).val( ui.values[0] );";
$constrain .= "$( '#Inputfield_{$this->name}2' ).val( ui.values[1] );";
+ // for change event checks
+ $constrain .= "$( '#Inputfield_{$this->name}1' ).trigger( 'change' );";
$val = "values: [ $( '#Inputfield_{$this->name}1' ).val(), $( '#Inputfield_{$this->name}2' ).val() ]";
$set = "$( '#RangeSlider_{$this->name}_display1' ).text( '$this->prefix' + $( '#RangeSlider_$this->name div' ).slider( 'values', 0 ) + '$this->suffix' );";
@@ -75,7 +77,11 @@ class InputfieldRangeSlider extends Inputfield {
$out .= "<input type='hidden' name='{$this->name}' id='Inputfield_" . $this->name . "1' value='" . $value->min . "'/>";
$display = "$( '#RangeSlider_{$this->name}_display1' ).text( '$this->prefix' + ui.value + '$this->suffix');";
+
$constrain = "$( '#Inputfield_{$this->name}1' ).val( ui.value )";
+ // for change event checks
+ $constrain .= "$( '#Inputfield_{$this->name}1' ).trigger( 'change' );";
+
$val = "value: $( '#Inputfield_{$this->name}1' ).val()";
$set = "$( '#RangeSlider_{$this->name}_display1' ).text( '$this->prefix' + $( '#RangeSlider_$this->name div' ).slider( 'value' ) + '$this->suffix' );";
@@ -86,6 +92,7 @@ class InputfieldRangeSlider extends Inputfield {
$out .= <<<_END
<script>
+$(function(){
$( '#RangeSlider_$this->name div' ).slider({
$range
$val,
@@ -96,10 +103,12 @@ class InputfieldRangeSlider extends Inputfield {
slide: function( event, ui ) {
$display
$constrain
+
}
});
-
$set
+});
+
</script>
<style>

0 comments on commit 9c78e40

Please sign in to comment.