mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-23 09:13:23 -05:00
Adds a better regexp thanks to this:
https://stackoverflow.com/questions/12643009/regular-expression-for-floating-point-numbers
This commit is contained in:
parent
21125249ea
commit
793fcb42e1
@ -741,7 +741,7 @@ $(function() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$("#redeemable_hours").spinner({
|
$("#redeemable_hours").spinner({
|
||||||
step: 0.10,
|
step: 0.01,
|
||||||
numberFormat: "n",
|
numberFormat: "n",
|
||||||
max: obj.current_year_volunteer_hours,
|
max: obj.current_year_volunteer_hours,
|
||||||
min: 0
|
min: 0
|
||||||
@ -752,8 +752,9 @@ $(function() {
|
|||||||
max = $this.spinner('option', 'max'),
|
max = $this.spinner('option', 'max'),
|
||||||
min = $this.spinner('option', 'min');
|
min = $this.spinner('option', 'min');
|
||||||
// We want only number, no alpha.
|
// We want only number, no alpha.
|
||||||
// We set it to previous default value.
|
// We set it to previous default value.
|
||||||
if (!val.match(/^[+-]?[\d]{0,}$/)) val = $(this).data('defaultValue');
|
//[+-]?[\d]{0,} [+-]?([0-9]*[.])?[0-9]+ [+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)
|
||||||
|
if (!val.match(/^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)$/)) val = $(this).data('defaultValue');
|
||||||
this.value = val > max ? max : val < min ? min : val;
|
this.value = val > max ? max : val < min ? min : val;
|
||||||
}).on('keydown', function (e) {
|
}).on('keydown', function (e) {
|
||||||
// we set default value for spinner.
|
// we set default value for spinner.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user