PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Using Gravity Forms to calculate fields

  1. Hi,

    I have a form where I have 3 fields (let's call them A, B, C)

    The overall result is determined by a calculation between these three fields. So for example, A*B/C

    I was wondering if this was possible and how I would go about it. I would need the result of the form passing through to the confirmation so I'd need it as a merge tag.

    Cheers,
    Steve

    Posted 12 years ago on Monday August 20, 2012 | Permalink
  2. Sure, take a look at this form I put together: http://gravity.chrishajer.com/calculate-additional-rear-axle-load/

    You can download a copy of that form here. Use the download or raw link, save the file to your computer's hard drive, and Import it into your Gravity Forms WordPress installation to see how it works.

    Posted 12 years ago on Monday August 20, 2012 | Permalink
  3. Hi, that's great - thank you for the response.

    I was just wondering... I don't want to see the calculation until after the submission page. What would be the best way to still have it added up, but hide the calculated number whilst the user is filling out the form. Is there something I can do in Gravity Forms or should I hide via CSS?

    Cheers,
    Steve

    Posted 12 years ago on Monday August 20, 2012 | Permalink
  4. David Peralty

    I would suggest hiding using CSS. Apply a class of hidden to the fields you don't want visible and in your theme's CSS just put:

    .hidden { display: none; }

    All my best.

    Posted 12 years ago on Monday August 20, 2012 | Permalink
  5. You can also make the field "Admin Only". That's what I did with the calculation for the additional load in kg. It appears in the confirmation text and the admin notification, but it does not show to the visitor filling out the form. You can make this calculation field Admin Only as well and it won't show to the visitor unless you use the merge tag somewhere (like the confirmation text or notification email.)

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  6. Hi - relating to the above post.
    I've created a calculating form using the above.
    What I would like to have is no submit button but a reset button.
    I'm creating a savings calculator so it shows the viewer immediately the result so I've no need.
    Is there a way to disable / hide the submit or replace it with a reset?
    Hope it's OK jumping in on this post.

    Cheers

    Pete

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  7. Pete, you could hide the submit button via CSS. For the Reset button, an easy way to do this would be to add an HTML standard field and put: <input type='reset' value='Reset'> within it.

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  8. Thanks Rob for the speed reply! Will give it a go cheers

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  9. Hi

    I'm able to hide the submit button but I have more than one form.
    How do I isolate the one button?

    Many thanks in advance

    Pete

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  10. If you inspect the page with chrome developer tools or firebug for firefox or simply view the source, you will see that each submit button has it's own unique ID, plus there are various other more specific ways to target it. If you have a link to your form I can point it out if you get stuck.

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  11. Cheers Rob will have a crack at it.

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  12. Hi Rob

    Sorry I can't get my head round it.
    If you could have a look at http://www.jensonecig.com/ I'd be really grateful.
    I want to style the form and remove the submit button.
    If you can show me how to identify the form in the style sheet I can get the rest.

    Huge thanks

    Pete

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  13. Hey Pete, no problem. Check out this Screenshot

    So you would use:

    [css]
    #gform_submit_button_2 {
    display: none;
    }
    Posted 12 years ago on Tuesday August 21, 2012 | Permalink
  14. Ah great stuff - thanks for the fast responses - great support!

    Posted 12 years ago on Tuesday August 21, 2012 | Permalink

This topic has been resolved and has been closed to new replies.