Viewing 4 replies - 1 through 4 (of 4 total)
  • type on Suffix .00 is this what you mean?

    For the Result eg. Total Cost it use Calculation Element Type, just tick on Money Format and it’ll show you the comma separator and paste this ‘€’ to replace Before ‘Value’ and also Prefix ‘Value’

    Hope that help, Tq

    Thread Starter marcusalbeny

    (@marcusalbeny)

    Hi scraido,

    Thanks for your answer.

    That is what I did for the Total Cost fields, and it works perfectly. My question, however, was regarding Range Slider “Loan Amount”. Just want to find a way to insert commas as thousand separator.

    Do you have any idea? Maybe a change in the PHP file?

    TY.

    Yeah maybe there’s something you can do on;

    caldera-forms\fields\range_slider >> field.php

    on <script type=”text/javascript”>
    after
    <?php
    if( false !== strpos( $field[‘config’][‘step’], ‘.’ ) ){
    $part = explode(‘.’, $field[‘config’][‘step’] );
    ?>

    //do some modification here…
    maybe you can insert ‘<?php echo $thousand_separator; ?>’ with add some function, like in function on calculation_field.php below:
    function addCommas(nStr){
    nStr += ”;
    x = nStr.split(‘.’);
    x1 = x[0];
    x2 = x.length > 1 ? ‘.’ + x[1] : ”;
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
    x1 = x1.replace(rgx, ‘$1’ + ‘<?php echo $thousand_separator; ?>’ + ‘$2’);
    }
    return x1 + x2;
    }

    //remember modif them to match range_slider needs

    //and also modif below value:
    value = value.toFixed( <?php echo strlen( $part[1] ); ?> );

    //look alike below result on calculation_field.php:
    total = total.toFixed(2);
    view_total = addCommas( total );

    //all modif changes before
    <?php } ?>

    I my self can’t do a programming, but theres a solution if you want a custom code here at https://calderawp.com/caldera-forms-services/

    Just a suggestion maybe you can create a new element named slider_wcomma, because if you do a change on default element they will be overwritten after you update your cf

    hope that help, tq

    I’m sorry before that first i think you should paste below code on:

    caldera-forms\fields\range_slider >> field.php

    //after…
    if(!empty($field[‘config’][‘prefix’])){
    $field[‘config’][‘prefix’] = Caldera_Forms::do_magic_tags($field[‘config’][‘prefix’]);
    }

    //paste this code…
    if( !isset( $field[‘config’][‘thousand_separator’] ) ){
    $field[‘config’][‘thousand_separator’] = ‘,’;
    }

    $thousand_separator = $field[‘config’][‘thousand_separator’];

    //before…
    if ( is_array( $field_value ) ) {
    if ( isset( $field_value[0] ) ) {
    $field_value = $field_value[0];
    }else{
    $field_value = 0;
    }
    }

    hope that help you, tq

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Thousand separator on Range Slider’ is closed to new replies.