Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support leading zeroes for the number field #7175

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sc0ttkclark
Copy link
Member

@sc0ttkclark sc0ttkclark commented Sep 21, 2023

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 sc0ttkclark added Type: Enhancement Enhancements to features that already exist, but are not major additions Component: DFV Issues related to the Pods DFV JS that powers form fields labels Sep 21, 2023
@sc0ttkclark sc0ttkclark added this to the Pods 3.0.3 milestone Sep 21, 2023
@sc0ttkclark sc0ttkclark self-assigned this Sep 21, 2023
Base automatically changed from release/3.0.2 to main September 21, 2023 15:31
@sc0ttkclark sc0ttkclark marked this pull request as ready for review September 21, 2023 15:31
@sc0ttkclark sc0ttkclark force-pushed the feature/numbers-support-leading-zeroes branch from 5e9e47f to a1f1769 Compare September 21, 2023 15:32
Copy link
Member

@JoryHogeveen JoryHogeveen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a nice addition, however the naming could be more general as we did with the currency field.

What do you think? Or do you consider the number field a totally different case?

classes/fields/number.php Show resolved Hide resolved
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0.3, Pods 3.0.4 Sep 22, 2023
Copy link
Member

@JoryHogeveen JoryHogeveen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sc0ttkclark
Copy link
Member Author

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.

@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0.4, Pods 3.0.5 Sep 23, 2023
@reedtsutton
Copy link

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
Copy link
Member

@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).

@sc0ttkclark sc0ttkclark marked this pull request as draft October 20, 2023 03:07
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0.9, Pods 3.0.10 Oct 20, 2023
@reedtsutton
Copy link

Hey guys any update on this one?

@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0.10, Pods 3.0.11 Dec 9, 2023
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.1.1, Pods 3.1.3 Feb 27, 2024
@reedtsutton
Copy link

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

@sc0ttkclark sc0ttkclark changed the base branch from main to release/3.2.2 April 9, 2024 22:49
@sc0ttkclark
Copy link
Member Author

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
Copy link

reedtsutton commented Apr 11, 2024

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

@sc0ttkclark sc0ttkclark force-pushed the release/3.2.2 branch 10 times, most recently from 557a510 to 510f18e Compare May 20, 2024 15:25
@sc0ttkclark sc0ttkclark force-pushed the release/3.2.2 branch 3 times, most recently from 01fb40a to c64b059 Compare June 17, 2024 21:49
Base automatically changed from release/3.2.2 to main June 18, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: DFV Issues related to the Pods DFV JS that powers form fields Type: Enhancement Enhancements to features that already exist, but are not major additions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants