Author: sergeyhalipov
Date: 2007-07-30 07:15:10 -0400 (Mon, 30 Jul 2007)
New Revision: 1917
Modified:
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
Log:
http://jira.jboss.com/jira/browse/RF-504
Modified:
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
---
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-30
10:23:09 UTC (rev 1916)
+++
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-30
11:15:10 UTC (rev 1917)
@@ -88,6 +88,8 @@
this.initialized = true;
Event.observe(window, "load",
this.setInitialValue.bindAsEventListener(this)); //FIX RFA-190
//Event.observe($(input), "propertychange",
this.setInitialValue.bindAsEventListener(this));
+
+ this.required = options.required;
},
setInitialValue: function(){
@@ -173,7 +175,7 @@
sliderValue = this.getNearestValue(sliderValue);
this.value = sliderValue;
this.handle.style.left = this.translateToPx(sliderValue);
- if (!this.editInFocus){
+ if (!this.editInFocus && (this.required || "" != this.input.value)){
this.input.value = this.value;
}
if (!this.tip.firstChild) {
@@ -297,7 +299,7 @@
this.eventError();
this.setValue(Number(this.input.value));
}
- this.value = this.input.value;
+ this.value = this.input.value ? this.input.value : this.minimum;
if(this.eventInputOnChange){
this.eventInputOnChange();
}
@@ -329,8 +331,9 @@
}
}
- if (e.keyCode == 13){
- this.input.value=this.getNearestValue(this.value);
+ if (e.keyCode == 13) {
+ if (this.required || "" != this.input.value)
+ this.input.value=this.getNearestValue(this.value);
this.input.form.submit();
}
if (this.eventChanged && this.isValueChanged()){
Modified: trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-30
10:23:09 UTC (rev 1916)
+++ trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-30
11:15:10 UTC (rev 1917)
@@ -127,7 +127,8 @@
inputId : "#{clientId}Input",
arrowSelected : "#{arrowSelected}",
onerr : "#{component.attributes['onerror']}",
- onchange : "#{component.attributes['onchange']}"
+ onchange : "#{component.attributes['onchange']}",
+ required : #{component.attributes['required']}
})
</script>
</td>