-
Notifications
You must be signed in to change notification settings - Fork 8
Description
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 }