• Resolved denisa

    (@elenadenisa)


    HI there, again
    I got the function to work finnaly, but when I try to fatch the fields value to vars, it not returning anything.

    if I assign a fix value to vars, like day = 2, days = 3 and so on…this is working perfect, but when I try to fetch the fields value to this, is not retutning anything.

    how should I assign the fields value corectly, pls
    this is the script:
    <script>
    function calcPrice(price, rate){
    var priceret;
    priceret = price + price*rate/100;
    return priceret;
    }

    function calcTotal (){
    var day, days, year, rate, total, price;
    day = fieldname2;
    days = fieldname6;
    years = fieldname11;
    rate = fieldname7;
    total = 0;
    price = day * days;

    for (var i = 1; i <= years; i++){
    price = calcPrice(price, rate);
    total = total + price;
    }

    return total;
    }
    document.getElementById(“fieldname12_1”).innerHTML = calcTotal();
    </script>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter denisa

    (@elenadenisa)

    got this one too, thank you
    day = jQuery(‘[id*=”fieldname2_”]’).val();

    Plugin Author codepeople

    (@codepeople)

    Hello @elenadenisa,

    Implement the project in this way is similar to re-invent the wheel, you are not using the potential of the plugin, please, look the equation I sent you in your other thread.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘fetching the field values in function’ is closed to new replies.