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.

Numbers field questions

  1. Nick
    Member

    I'm using some numbers fields to do some basic math based on a user submission in the first number field. Two questions:

    1. Can I make the calculation fields empty until the first field is filled in? As it is, they show weird numbers based on the math that are completely irrelevant.

    2. Since the numbers represent money, is there a way to force two decimal places even when the hundredths place is zero? I want 2.50 to show as 2.50, not 2.5.

    Thanks!

    Posted 11 years ago on Sunday February 3, 2013 | Permalink
  2. Can you use conditional logic to hide the field until the last number required for the calculation is entered? I don't know of a way to blank the field out until the last value is entered, without using jQuery.

    Please see this for formatting a field as currency:
    http://gravitywiz.com/2012/05/24/format-field-as-currency/

    That was written by Gravity Forms developer David Smith.

    Posted 11 years ago on Monday February 4, 2013 | Permalink
  3. Nick
    Member

    Duh, I should have thought about conditionally displaying the math fields, that's an easy one. Thank you.

    Unfortunately the link you sent keeps breaking my form. Plus, reading through the comments, it doesn't work on number fields, which I need since I'm doing math.

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  4. "Unfortunately the link you sent keeps breaking my form."

    Can you explain what you mean?

    To force a field to be 2 decimal places, and still be a number, you can use different jQuery, like this http://stackoverflow.com/a/478266

    Posted 11 years ago on Tuesday February 5, 2013 | Permalink
  5. cphillips.ia
    Member

    I have the same issue. The "breaking" in http://gravitywiz.com/2012/05/24/format-field-as-currency/ references some single quotes the were not escaped, but that aside, this did not actually solve the problem. The solution David highlights in his article only works with text fields, not number fields... We need several fields that do calculation to display results as currency.

    Posted 11 years ago on Monday March 11, 2013 | Permalink
  6. @cphillips.ia, please include a link to the page on your site where we can see the form, and let us know which fields you're trying to format as currency. David's solution was meant to work in general cases, but you may need something more specific, but utilizing the same approach.

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  7. cphillips.ia
    Member

    Is there a way to email or PM the link / info to you?

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  8. Please email chris@rocketgenius.com - there is no PM function here.

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  9. I've been having a similar problem. I have two number fields feeding into a total number field with a calculation and for some reason the snippet suggested here http://gravitywiz.com/2012/05/24/format-field-as-currency/ breaks two of number fields the total one displays fine. Here's a link to the test form I've been working on http://www.christianlegacy.org.uk/pdf-form-test/ . I've also noticed that the two non functioning numbers fields are also not displaying decimal points number format. Is there any reason for this?

    Posted 11 years ago on Tuesday March 19, 2013 | Permalink
  10. The number fields will not work for calculations after applying this code. Please see this comment from David Smith http://gravitywiz.com/format-field-as-currency/#comment-1589

    Posted 11 years ago on Thursday March 21, 2013 | Permalink