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

[Panel] Number field removes decimal values when they are 0. #1748

Closed
texnixe opened this issue May 3, 2019 · 3 comments
Assignees
Milestone

Comments

@texnixe
Copy link
Contributor

@texnixe texnixe commented May 3, 2019

Describe the bug
When a number field is set to decimal values using the step option:

fields:
  price:
    label: Price
    type: number
    step: .01

and you select a number where the decimals are zero, e.g. 15,00, the zeros are removed when saving or reloading, also the number is stored without the decimals.

To Reproduce
Steps to reproduce the behavior:

  1. Add above field in any blueprint
  2. Visit page in panel and add number, e.g 15,00
  3. Save and reload
  4. See zeros vanishing. They are also not stored.

Expected behavior
Zeros should be stored in the content file and not disappear.

Kirby Version
3.1.3

https://forum.getkirby.com/t/decimal-number-fields-dont-allow-00-anymore/14066

@distantnative distantnative added this to the 3.1.4 milestone May 10, 2019
@distantnative distantnative self-assigned this May 10, 2019
distantnative added a commit that referenced this issue May 10, 2019
distantnative added a commit that referenced this issue May 11, 2019
@distantnative distantnative modified the milestones: 3.1.4, 3.2.0 May 12, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.2.0, 3.2.1 Jun 3, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.2.1, 3.2.2 Jul 2, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.2.2, 3.2.3 Jul 10, 2019
@distantnative distantnative removed their assignment Jul 18, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.2.3, 3.2.4 Jul 30, 2019
@bastianallgeier bastianallgeier removed this from the 3.2.4 milestone Aug 22, 2019
@distantnative distantnative self-assigned this Sep 15, 2019
@distantnative distantnative added this to the 3.2.5 milestone Sep 15, 2019
distantnative added a commit that referenced this issue Sep 15, 2019
distantnative added a commit that referenced this issue Sep 15, 2019
@distantnative distantnative modified the milestones: 3.2.5, 3.3.0 Sep 15, 2019
distantnative added a commit that referenced this issue Sep 15, 2019
@distantnative

This comment has been minimized.

Copy link
Contributor

@distantnative distantnative commented Oct 11, 2019

I have tried several attempts. With the native HTML number field this is not possible as it seems.
I agree that in the Panel it owuld be nicer if it always has the same amount of decimals as in the step.

It should not matter how it is stored in the content file though. If the frontend needs it displayed with a certain number of decimals, then this should be ensured by frontend code.

I am closing this for now as I don't think we can achieve this - @bastianallgeier .

@bastianallgeier

This comment has been minimized.

Copy link
Contributor

@bastianallgeier bastianallgeier commented Oct 11, 2019

I think I just found a solution! Check out the PR!

bastianallgeier added a commit that referenced this issue Oct 11, 2019
bastianallgeier added a commit that referenced this issue Oct 11, 2019
distantnative added a commit that referenced this issue Oct 11, 2019
@distantnative distantnative added this to the 3.3.0 milestone Oct 11, 2019
@distantnative

This comment has been minimized.

Copy link
Contributor

@distantnative distantnative commented Oct 11, 2019

@bastianallgeier just proved me wrong XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.