Open Shelob9 opened 6 years ago
Immediate work around is to set 0.1 as the value for the "steps" setting for your number field.
Or use the caldera_forms_field_attributes-number
filter.
See: https://calderaforms.com/doc/caldera_forms_field_attributes/
add_filter( 'caldera_forms_field_attributes-number', function( $attrs ){
$attrs[ 'step' ] = 'any';
return $attrs;
});
So here is the thing, if you do not have the step attribute set, 1.5 is not valid according to HTML5 as implemented in Chrome. I made a whole CodePen to remind myself how exactly HTML5 works: https://codepen.io/Shelob9/pen/qoyXrK?editors=1000
So basically, Caldera Forms 1.6.0 restores the correct functionality for number fields as it relates to the step attribute.
But in Caldera Forms 1.5.9.1 if you have a number input without setting the step attribute, and enter 1.555, that's valid, because of a bug in the validation library we're using - Parsely.
So to clarify:
Options:
I'm punting this as I'm not sure if it should be fixed or not.
To clarify - is .1 the best step value if we are working with "money"? I tried this and I still got "this value seems to be invalid
I tried 0.05 and that fixed it :)
That setting controls the value of the "step" attribute of the input.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step
I would consider this a bug if the behavior of our number field was not to the spec.
If you set .1, then 1.01 is not valid. If you set steps to .01, then 1.01 will be valid.
On Wed, Nov 7, 2018, 7:09 AM brustar64 <notifications@github.com wrote:
I tried 0.05 and that fixed it :)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/CalderaWP/Caldera-Forms/issues/2402#issuecomment-436602864, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5uR-1seqG6Cw9Q9c0ygY3Fu1Dv_vnoks5uss1dgaJpZM4TFn2Y .
Thanks Josh,
I'm not sure why that didn't work the first time I tried it. I used 0.01 this time instead of just .01 and that works so maybe that was the issue.
regards Bruce
From: Josh Pollock notifications@github.com Sent: Thursday, 8 November 2018 4:44 AM To: CalderaWP/Caldera-Forms Cc: brustar64; Comment Subject: Re: [CalderaWP/Caldera-Forms] Unless steps setting is used, number fields with decimals not considered valid (#2402)
That setting controls the value of the "step" attribute of the input.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step
I would consider this a bug if the behavior of our number field was not to the spec.
If you set .1, then 1.01 is not valid. If you set steps to .01, then 1.01 will be valid.
On Wed, Nov 7, 2018, 7:09 AM brustar64 <notifications@github.com wrote:
I tried 0.05 and that fixed it :)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/CalderaWP/Caldera-Forms/issues/2402#issuecomment-436602864, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5uR-1seqG6Cw9Q9c0ygY3Fu1Dv_vnoks5uss1dgaJpZM4TFn2Y .
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/CalderaWP/Caldera-Forms/issues/2402#issuecomment-436733631, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbqjrzFj3p4UIXY5ltQzluZ314dZhNTKks5usyoWgaJpZM4TFn2Y.
Maybe related: https://github.com/guillaumepotier/Parsley.js/issues/1129
Presumably broken via: #2346
If a number field has a decimal it does not validate properly on form submission, multi-page validation works.