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.

No Duplicates on hidden field

  1. Hi
    I have created a form that has a hidden field with the label "UID". I use this field to store a custom unique identifier based on a few different user variables.

    Before saving the form I want to check if the UID already exists in the database. If the field was not hidden I could check the "no duplicates" checkbox on the field and it would be validated as required.

    How do I go about achieving this with a hidden field? I have been looking at the "gform_is_duplicate" hook and not had much luck in getting it to work.

    Thanks.

    Posted 13 years ago on Friday April 8, 2011 | Permalink
  2. I'm assuming if the UID already exists you would generate a new one and want to replace the existing one with the new one? Because as it's a hidden field you wouldn't want to throw an error because it's a hidden field...

    Posted 13 years ago on Friday April 8, 2011 | Permalink
  3. Hi Carl
    Thanks for getting back. I have actually come up with a solution and you can see the code here:

    https://gist.github.com/913464

    The UID already exists and I would not be updating it with a new one. Your right about throwing an error on a hidden field... my original version of the code did that and the user experience is off. In the end I made it so it threw the error onto all visible fields. Not perfect but it works.

    Scott

    Posted 13 years ago on Monday April 11, 2011 | Permalink

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