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.

Hidden fields are not added to pricing total

  1. hpacollect
    Member

    I've got a custom total price calculation working after getting help from David Smith in this thread (thanks again):

    http://forum.gravityhelp.com/topic/custom-total-price-calculation#post-18327

    I would reply to the thread directly but it has been closed already.

    His suggestion to use a User Defined field for my fee calculation works, but when it is hidden by setting the CSS to "display: none" as suggested in the last step it stops working. This seems due to the gformGetBasePrice function of gravityforms.js where there are two areas where there is a comment: "//If field is hidden by conditional logic, don't count it for the total"

    If commented out the relevant code and it works fine now, but the whole point of this was not to touch the gravityforms.js so the form wouldn't get screwed up by Gravity Forms updates.

    Is there any trick to hiding a pricing element and still having it count for the total without touching gravityforms.js?

    Posted 13 years ago on Tuesday February 15, 2011 | Permalink
  2. Hm, alternately you could hide the item by setting the css to something like this:

    #yourfield { position: absolute; visibility: hidden; }

    Posted 13 years ago on Tuesday February 15, 2011 | Permalink
  3. hpacollect
    Member

    David,

    Thanks for reply and all your help so far, I'm learning a lot through this process.

    I've tried this alternate way of hiding the field, but the results are the same. Even with this new way of hiding the field, unless those lines in the gravityforms.js are commented out, the total won't calculate.

    Just one more strange thing that I noticed. Even with the lines commented out in my last post, the total doesn't work in Google Chrome (Firefox or IE are okay). I get the Javascript error "Uncaught SyntaxError: Unexpected token (" near the start of the price section of in gravityforms.js on this line:

    function (element){
    return element.parents('.gfield').css("display") == "none";
    }

    I just comment out that three line function (in addition to the other lines I mentioned in the last post) and the custom total works in Chrome. If I don't comment those three lines out the total doesn't work in Chrome. If works fine either way in Firefox and IE.

    Strange isn't it?

    Posted 13 years ago on Tuesday February 15, 2011 | Permalink
  4. Are you using the latest versions of Gravity Forms? The behavior you described is very odd. First things first, I double checked on that CSS I provided for hiding the field and it is working fine on my side. Would it be possible to provide us with a login to your website so we can debug this issue further? If so, send the login details through our contact form with "ATTN: David" at the top of the message.

    Posted 13 years ago on Friday February 18, 2011 | Permalink