• Resolved davidpokorny

    (@davidpokorny)


    Hello, I have a bit complicated question.

    We have a calculation that is based on only 1 input. The result changes according to the input’s number.

    We have 3 ranges that display 3 different results, for example:
    – from 0 to 100 => result says “$50 is the cost”
    – from 101 to 200 => result says “$100 is the cost”
    – from 201 to 2000 => result says “Price ranges from $150 to $600”

    The first two work just fine. The results are created as a basic sentence as follow:
    const 1st= “$50 is the cost”;

    The problem is our 3rd result. The third result is based on this calculation:
    fieldname*3.5 and fieldname*6.5.
    Like this “Price ranges from fieldname*3.5 to fieldname*6.5”

    My question is twofold – How can I display two values inside of one result? How can I add the dollar tag to the numbers?

    If I’m not being clear enough, please let me know
    Thank you

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

    (@codepeople)

    Hello @davidpokorny

    You can use the CONCATENATE operation:

    CONCATENATE('Price ranges from $', fieldname1*3.5, ' to $', fieldname1*6.5)

    Best regards.

    Thread Starter davidpokorny

    (@davidpokorny)

    You are the best. Love your support. Thanks!

    Thread Starter davidpokorny

    (@davidpokorny)

    Sorry, I have an additional question.

    How can I display the result as an html text?

    What I need to basically do is this:
    – from 0 to 100 => result says “<span clas=”number”>$50</span> <span clas=”description”>is the cost</span>”

    Plugin Author codepeople

    (@codepeople)

    Hello @davidpokorny

    In this case, you must use the calculated field as an auxiliary to make the calculations but display the result into another tag that renders HTML.

    * Insert an “HTML Content” field in the form with a tag where the display the result as its content, for example:

    <div class="result-here"></div>

    * Edit the equation to display the result into the previous tag:

    
    (function(){
    var result = '';
    
    if(fieldname1<=100) result = '<span class="number">$50</span> <span class="description">is the cost</span>';
    else if(fieldname1<1000) result = '<span class="number">$500</span> <span class="description">is the cost</span>';
    else result = '<span class="number">$1000</span> <span class="description">is the cost</span>';
    
    jQuery('.result-here').html(result);
    return result;
    })()
    

    Finally, since the calculated field is used as an auxiliary, you can hide it by ticking a checkbox in its settings.

    Best regards.

    Thread Starter davidpokorny

    (@davidpokorny)

    Thank you so much, love it!
    My very last question – How can I make the Up and Down buttons always visible for our Field Type: Number input?

    Right now it’s only visible when hovered over the input. And, can I style the arrows by using CSS?

    Thanks!

    Plugin Author codepeople

    (@codepeople)

    Hello @davidpokorny

    These arrows are not controlled or included by our plugin. They are included directly by browsers in input tags with type="number". However, you can force the browsers to display them always by entering the style definition below through the “Customize Form Design” attribute in the “Forms Settings” tab (https://resources.developers4web.com/cff/images/documentation/form-settings-tab.png)

    #fbuilder input[type=number]::-webkit-inner-spin-button, #fbuilder input[type=number]::-webkit-outer-spin-button { opacity: 1; }

    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Displaying two values as a result’ is closed to new replies.