Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    Suppose your form includes two date fields, start date (called fieldname1) and end date (called fieldname2), the corresponding equation in this case would be:

    (function(){
    var r = abs(fieldname2-fieldname1);
    if( r == 1) return 15;
    if( r == 2) return 27;
    if( r > 2 ) return 5*r;
    })();

    Note: Transform the previous equation with the fields names used in your form.

    Thread Starter damiend1

    (@damiend1)

    Hi,

    Tanks it works !

    After this i just need to add a somme for an option, How its possible to calculate, the result of the function above and other variable.

    Tanks

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Suppose that your equation includes another field (called fieldname3) that should be added to the value related with the date fields, in this case the equation should be modified like follow:

    (function(){
    var r = abs(fieldname2-fieldname1);
    var n;
    if( r == 1) n = 15;
    if( r == 2) n = 27;
    if( r > 2 ) n = 5*r;

    return n+fieldname3;
    })();

    Note: the previous equation is only a demo, but contains the pattern to create your own equation.

    Thread Starter damiend1

    (@damiend1)

    Wouaw tanks ! amazing plugin, just need to go to pro version !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fixed value between two dates’ is closed to new replies.