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.

Remove $ from Total Field

  1. I have a donation form where the user can select from a number of donation amounts. There is also an option for other amount. When other amount is selected the form shows another field so the user can enter a different amount. The form has a total field to keep track of the total amount. When the form is submitted a query string is created and the user is sent to the credit card processing site.

    The problem is that the total field inserts a dollar sign in the query string, which results in an error from the credit card processing site. I have enabled Pass Field Data Via Query String and use the total field in that query string.

    I need to remove the dollar sign in some fashion or find a way to not have to use the total field.

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  2. Have you tried adding :price to the merge tag? Like this:

    {fieldname:price}

    Related:
    http://www.gravityhelp.com/forums/topic/identical-values-cause-problem-with-conditional-logic#post-77942

    Posted 11 years ago on Wednesday October 24, 2012 | Permalink
  3. Here is a simple snippet that will remove the $ from the URL:

    http://pastie.org/5111190

    Posted 11 years ago on Wednesday October 24, 2012 | Permalink
  4. Hello Chris and David,
    I understand that the code example from http://pastie.org/5111190 goes into the functions.php of my theme. I'm linking the forms using this GET string: https://esqa.moneris.com/HPPDP/index.php?ps_store_id=QASHTtore2&hpp_key=hpYEZK8JU3J4 - and I'm passing the total amount via the query string of the form, like this: charge_total={TOTAL (HST included) (Price):17.2}.

    I still haven't been able to remove the $ sign from the total. Can you please tell me if I'm doing something wrong or if I need to do something else.

    Thanks a lot!

    Posted 11 years ago on Thursday December 27, 2012 | Permalink
  5. What does the full URL look like once the merge tag is added to your query string?

    Posted 11 years ago on Thursday December 27, 2012 | Permalink
  6. It does not look like the code is being processed at all. Can you make sure that you changed the form ID from 148 to your proper form ID?

    Also, are you using a "redirect" for your confirmation setting, and the query string is already populated and working there?

    This code is pretty simple and works, but it does not look like it's working for you at all. Can you post the actual code you are using, the whole thing, including the hook? And, post a link to your form if you can.

    Posted 11 years ago on Friday December 28, 2012 | Permalink
  7. I changed the form ID and it's working now!
    One more thing, I need to add this same function to two other forms. Do I need to modify the same code that goes into the functions.php or that has to be done somewhere else?
    Thanks for your help Chris!

    Posted 11 years ago on Saturday December 29, 2012 | Permalink
  8. You can duplicate this code three times, changing the form ID in each one. But in addition, you will need to rename the function, otherwise you will get an error "Fatal error: Cannot redeclare function" because you are trying to declare the function custom_confirmation more than once.

    You can name them like this:
    custom_confirmation_1
    custom_confirmation_2
    custom_confirmation_3

    Or with the form ID:
    custom_confirmation_148
    custom_confirmation_17
    custom_confirmation_2

    Or go totally different like this:
    confirmation_for_product_one
    confirmation_changer
    confirmation_strip_dollar

    When you change the function name, you need to do it on the line which begins "add_filter" and also on the line which begins "function". So, copy the block of code so it appears three times, leave one alone, then edit the other two to apply to different forms, then change the function name twice in each block. If you have trouble, paste your code at pastie.org or pastebin.com and let us know what error you are getting.

    Posted 11 years ago on Saturday December 29, 2012 | Permalink
  9. Hi Chris, this is the code I'm using http://pastie.org/5603183 but it only works when I preview the forms. When I test the forms from the actual website it doesn't work. Any idea why?
    Thanks!

    Posted 11 years ago on Monday December 31, 2012 | Permalink
  10. Please share a link to the page on your site where we can see a form which uses this functionality. I can't see why it would work in the preview mode and not on the live site. The code looks OK.

    Posted 11 years ago on Monday December 31, 2012 | Permalink
  11. I figured that out already it was a conflict with the page where the form was embedded. All is working ok!
    One more thing and I leave you alone. Is there a way to send the total and other info hidden?
    Thanks and Happy New Year!

    Posted 11 years ago on Tuesday January 1, 2013 | Permalink
  12. What do you mean send the total and other information hidden? Do you mean you do not want it sent as a GET request and visible as part of the URL?

    Posted 11 years ago on Tuesday January 1, 2013 | Permalink
  13. Yes, that's exactly what I meant. Is it possible?

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink
  14. It looks like Moneris is using the query string with the information visible. How will you send them the information if not in the query string like this?

    If you want to hide that information, you will have to use something other than a GET request, like your initial example here. If you want to do that, please open a new topic. We will need a different approach, possibly using the gform_after_submission hook. http://www.gravityhelp.com/documentation/page/Gform_after_submission It is more complicated than sending the variables in the query string like you have done so far.

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink
  15. I understand that's a different approach but I'd rather send it hidden. I used a GET request as that was the easiest and fastest way to get the site ready. I will open a new topic to try the Gform after submission.
    Thank you for your outstanding support!

    Posted 11 years ago on Thursday January 3, 2013 | Permalink
  16. Continued here: http://www.gravityhelp.com/forums/topic/moneris-integration

    Posted 11 years ago on Thursday January 3, 2013 | Permalink

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