pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.06k stars 264 forks source link

Support leading zeroes for the number field #7175

Open sc0ttkclark opened 9 months ago

sc0ttkclark commented 9 months ago

Description

This PR adds support for the number field having leading zeroes even after formatting.

via feedback at https://wordpress.org/support/topic/leading-zero-in-number-field-3/

Testing instructions

TBD

Screenshots / screencast

TBD

Changelog text for these changes

TBD

PR checklist

sc0ttkclark commented 9 months ago

We could probably put more time into this to figure out how many zeroes to limit to or if padding should be done as well.

reedtsutton commented 9 months ago

Would it be nice to set the maximum allowed leading zero's? Or even a minimum amount of digits (excluding decimals)?

Is it possible to just make it so the zeros can be entered? User can enter 0123 or 00123 and it displays as entered?

JoryHogeveen commented 9 months ago

@sc0ttkclark @reedtsutton Just an idea for a first solution. An option to disable formatting all together and allow all numeric type formats with a simple regex?

So basically, within the "_format" selectbox we add an option "none" or "any" witch disabled all formats but only runs the value through a regex that filters out everything except for decimals (if enabled).

reedtsutton commented 7 months ago

Hey guys any update on this one?

reedtsutton commented 3 months ago

Hey guys wondering if there is going to be any movement on this?

sc0ttkclark commented 3 months ago

We just need to sort out exactly what we want from this enhancement. I'll look at this in the upcoming release when I can.

reedtsutton commented 3 months ago

There is actually a separate (but probably related?) issue where an entry of 0 in the currency field is being treated to be a null value (see screenshots #1 and #2).

This compounds when I try to pass the value to another post type, and the resulting field ends up being blank (screenshots #3 and #4).

Screenshot 1 1 - manual entry of 0 in currency

Screenshot 2 2 - still shows as empty

Screenshot 3 3 - post feed

Screenshot 4 4 - offer rebate is empty