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.

Disable/bypass validation of fields, esp. checkboxes

  1. stevehong
    Member

    In short, I want to know how to disable validation of a field, regardless its value. I'm using Javascript to dynamically change the values of pricing checkboxes based on user input in other fields. It seems that something in the standard validation of checkboxes causes a failure whenever the values are altered in the DOM.

    So I looked at the validation hook and tried to bypass validation of the field by adding a class "skipValidation" to the checkboxes and setting $field['failed_validation'] = false;
    http://www.pastie.org/2450179

    But the front-end effect of this is only to give the appearance that the field is valid. The form itself still seems to be invalid and displays "There was a problem with your submission. Errors have been highlighted below." But there are no actual errors highlighted.

    It seems to me that I can't actually just validate the whole form with $validation_result['is_valid'] = true;
    because then none of the other fields will attempt validation, and I've essentially turned off validation for the entire form.

    I think my method would actually work if I wasn't using a multiple input field like checkboxes. The validation hook documentation seemed to indicate something is different about checkboxes: "This method for retrieving the field value will work for most fields. Known exceptions are checkboxes and fields with multiple inputs. We will cover those later as an addition to this walk-through." I couldn't find this additional document covering these exceptions.

    I need to use the pricing options because I'm trying to send additional costs to Cart66, which picks up the cost increases when I add, for example, " +$1000" to the value of the choices. However, the additional costs are not fixed and need to be calculated, so I'm using Javascript to calculate and modify the input values in the DOM. Here's what I'm doing to the HTML:
    http://www.pastie.org/2450390

    In summary, I would appreciate if someone can help me to bypass validation of a specific set of checkboxes or show me another way to get Cart66 to pick up dynamically calculated cost increases to a product when integrated with Gravity Forms. Thanks.

    P.S. I only code a little Javascript, so please try to explain any PHP answers simply. Also, I can't post a URL to a live example, as I'm still in development.

    Posted 12 years ago on Monday August 29, 2011 | Permalink
  2. This is a security feature to prevent users from changing the price in the DOM and submitting the form with the wrong price.

    To disable that validation, set your checkbox fields to "allow field to be populated dynamically" in the advanced tab. When that option is checked, the state validation is bypassed.

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink
  3. stevehong
    Member

    I thought allowing dynamic population would fix it, but there's no difference whether I check that option or not. My Javascript changes the values in the DOM before submission, and the checkboxes come back with errors. Is there something else I need to do?

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink
  4. What version of Gravity Forms are you running?

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink
  5. stevehong
    Member

    I'm running Gravity Forms Version 1.5.2.8.

    Posted 12 years ago on Tuesday August 30, 2011 | Permalink
  6. As far as I can tell, that option should be all you need to do. I am gonna need to take a closer look at it. Is there any way you can put this on a public test site? I will be difficult for me to help you without actually seeing what is going on.

    Posted 12 years ago on Wednesday August 31, 2011 | Permalink
  7. Have similar Issue , Will monitor to see if there's any resolve :::

    Posted 12 years ago on Saturday September 3, 2011 | Permalink