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.

PayPal hidden product field not validating after dynamic update

  1. Hi Guys

    I've got a problem which is similar to this post ( but I can't find an answer or a solution on the forums.

    Here's what I'm experiencing:

    - I have a hidden product field for a service fee (the client is using this to cover the PayPal transaction fee)
    - The client needs it to be multiplied by the number of swimmers the user is paying for
    - I've written a short piece of jQuery to update the product field when the number of swimmers is selected:

    <script type="text/javascript">
        var num_swimmers = jQuery("#input_5_5 option:selected").val();
        var charge = num_swimmers * 3;
        charge = charge.toFixed(2);
        jQuery("#ginput_base_price_5_34").val("£ " + charge);
        alert( jQuery("#ginput_base_price_5_34").val() );

    The last alert shows the correct value, and matches the format of the product field when the page loads, but I get a validation error: "There was a problem with your submission. Errors have been highlighted below."

    When I inspect the page, I can see that it's saying "Please enter a valid value." for the service charge.

    Please could you let me know what I'm doing wrong? I really can't see the difference between my calculated value and the valid default value.



    Posted 9 years ago on Tuesday September 11, 2012 | Permalink
  2. Hi Guys,

    Have you had a chance to look at this for me? I'm really confused as to why I can't make the field validate and my client is breathing down my neck!

    Thanks in advance

    Posted 9 years ago on Friday September 14, 2012 | Permalink
  3. You are getting that error because you are manipulating the product price via jQuery, and that is triggering a safety validation that GF performs on product fields. In order to disable that extra validation, you can enable to option to "Allow field to be populated dynamically" in the field editor.

    Posted 9 years ago on Friday September 14, 2012 | Permalink
  4. Hi Alex, so simple when you know how! Thank you so much, that's solved the problem.

    All the best

    Posted 9 years ago on Friday September 14, 2012 | Permalink

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