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.

Custom Field Validation

  1. Hi all,

    I have a UK post code field (new postcode) on a form and am validating it using the validation_hook (as per VIN example). The validation works fine for the field (new postcode).

    Now I've added another field (old postcode) assigned the cssClass to validate-postcode as per new postcode field, now when I submit the form the pre-loader just spins and forms does not submit.

    So 1 field works fine, now 2 fields and form breaks? Any ideas ?

    Thanks

    Posted 12 years ago on Friday April 6, 2012 | Permalink
  2. Can you post the code you used here using pastie or something similar and a link to your form?

    Posted 12 years ago on Friday April 6, 2012 | Permalink
  3. Code and functions are here: http://pastie.org/3744219

    Form test page can be found here : http://www.brproperty.co.uk/formtest/

    Thanks

    Posted 12 years ago on Saturday April 7, 2012 | Permalink
  4. The problem was the function stringrpl() was being declared inside the is_postuk() function and that was creating a multiple declaration error when the is_postuk() function was executed more than once. Also, there is an easier hook to use for your scenario (gform_field_validation). The following code snippet should do the trick for you.
    Let me know if not.
    http://pastie.org/3755939

    Posted 12 years ago on Monday April 9, 2012 | Permalink