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

Problem on render decimals value backend #13

Open
cicoph opened this issue Oct 7, 2021 · 0 comments
Open

Problem on render decimals value backend #13

cicoph opened this issue Oct 7, 2021 · 0 comments

Comments

@cicoph
Copy link

cicoph commented Oct 7, 2021

Before save the value on DB the code replace the current decimal separator with dot (and also remove the thousand separator). On render the value on backed you must replace the dot separator decimals with the selected separator:
For V5
public function render_field( $field ) { $format = $this->parse_format( $field['format'] ); $field['value'] = str_replace( '.', $format['decimal_point'], $field['value'] ); ?> <input type="text" id="<?php echo $field['id'] ?>" class="acf_price" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" data-format-decimals="<?php echo $format['decimals'] ?>" data-format-decimal_point="<?php echo $format['decimal_point'] ?>" data-format-thousands_separator="<?php echo $format['thousands_separator'] ?>" /> <?php }
For V4

function create_field( $field ) { $format = $this->parse_format( $field['format'] ); $field['value'] = str_replace( '.', $format['decimal_point'], $field['value'] ); ?> <input type="text" id="<?php echo $field['id'] ?>" class="acf_price" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" data-format-decimals="<?php echo $format['decimals'] ?>" data-format-decimal_point="<?php echo $format['decimal_point'] ?>" data-format-thousands_separator="<?php echo $format['thousands_separator'] ?>" /> <?php }

@cicoph cicoph changed the title Problem on render value decimal Problem on render decimals value backend Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant