WordPress.org

Forums

Calculated Fields Form
[resolved] How to hide output and make PREC work (7 posts)

  1. OliverEggertsen
    Member
    Posted 9 months ago #

    Hi.

    How can i hide the output, so that the output only appears when a calculate button is pressed?

    And i can't make the PREC function work. The output is not displaying two decimals as i want it too.

    http://www.invested.dk/udregnere/fremtidsvaerdi/

    This is my equation: PREC(POW(fieldname4*(1+fieldname2/100),fieldname3),2)

    Thanks.

    https://wordpress.org/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 9 months ago #

    Hi,

    I've tested your form and the result have only two decimal digits with all combinations of values used.

    About hide the calculated field until the calculate button be pressed. I suggest assign a classname to the calculated field through the "Add Css Layout Keywords" attribute, for example myclass, and then paste the following class definition in any of CSS files of your website:

    .myclass{display:none;}

    Finally in the equation uses the snippet of code:

    jQuery('.myclass').show();

    In this case, the equation should be defined in the format:

    (function(){
    jQuery('.myclass').show();
    return PREC(POW(fieldname4*(1+fieldname2/100),fieldname3),2);
    })()

    Best regards.

  3. OliverEggertsen
    Member
    Posted 9 months ago #

    Hi Codepeople.

    It's not working for me.
    If i for example enter 2, 20, 100 in the fields i get Kr.1,4859473959783544e+40 in the calculated field.

    Also, i tried doing the things about hiding the calculated field and it's not working either. Where should the jQuery code be entered?

    Thanks

  4. codepeople
    Member
    Plugin Author

    Posted 9 months ago #

    Hi,

    The issue is simple, the result is a big positive number, that should be represented with scientific notation.

    About the new class "myclass", you should include its definition in a css file loaded in your website. I've checked the styles loaded in your website and I've not found the this class definition.

    Best regards.

  5. OliverEggertsen
    Member
    Posted 9 months ago #

    Hi,

    Oops, that was my fault.

    I've now added .myclass {display:none;} to both the style.css and custom.css files, and it is still not working.

    Thanks

  6. codepeople
    Member
    Plugin Author

    Posted 9 months ago #

    Hi,

    You have forgotten uncheck the option: "Evaluate dynamically the equations associated to the calculated fields", from the "Form Settings" tab of your form.

    Best regards.

  7. OliverEggertsen
    Member
    Posted 9 months ago #

    Thanks for the help :-)

Reply

You must log in to post.

About this Plugin

  • Calculated Fields Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags