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.

Duplicate entries

  1. twessel
    Member

    Is there a way to prevent or have conditional logic that prevents duplicate post title entries? Thanks so much.

    Posted 13 years ago on Thursday May 26, 2011 | Permalink
  2. There is not currently functionality that prevents duplicate post titles if you are using the Post Title field. But you can work around this using other fields and then the content template functionality of the Post Title field.

    - Add a Single Input field to your form, use this field for the user to enter the title of the post.
    - Edit the Single Input field, select the "No Duplicates" checkbox under the Rules
    - Add a Post Title field to your form
    - Select the Content Template feature of the Post Title field and from the "Insert form field" drop down, select the Single Input field you created above. If it doesn't appear in the drop down, you may need to first save your form and then choose Continue Editing and then edit the Post Title field and configure the Content Template.
    - Edit the Post Title field again, choose the Advanced Tab and set the visibility to Admin Only
    - Save your form

    What this will now do is the user will enter the title of their post in a Single Input field that has a No Duplicates rule, meaning it won't allow duplicates. Duplicates being other form submissions that already exist, NOT existing Posts. If no duplicate it is found the form will be submitted and the Post Title will use the value of this field as it's value when creating the post.

    So it's a workaround that can work, although the no duplicates is only against existing form entries and not existing posts you may have when this is implemented.

    I will look into adding no duplicates as an option on the Post Title field in the 1.5.3 release.

    Posted 13 years ago on Thursday May 26, 2011 | Permalink
  3. twessel
    Member

    Super...Thanks.

    If I configured it that way, would I be able to add a post on the back-end, then flip back to the form and submit the same same post? Or does it only recognize form submitted posts? Thanks again.

    Posted 13 years ago on Friday May 27, 2011 | Permalink
  4. Doing it this way it will only trigger the duplicates validation if the post was created using the form. It actually does the duplication validation against the Form Entry data in this scenario, not the actual Posts.

    Posted 13 years ago on Friday May 27, 2011 | Permalink
  5. How do you enable no duplicates for a series of drop down questions? I have 10 drop down questions. I need a unique answer for each of the 10.

    However, this survey will be sent to 2,000 people. I want to prevent duplicates per person. But I don't want to prevent duplicates entered by different people.

    For example, if person A answers "A" for question 1. I don't want them to answer "A" for question 2 through 10. BUT, if person B answers "A" for question 1, I WANT to include that. I don't consider that a duplicate because it is entered by a different survey participant.

    Posted 13 years ago on Monday July 18, 2011 | Permalink
  6. You can't prevent duplicates per person as a built in feature. The no duplicates option is for all form submissions, not specific people. In order to do something like this you would have to write your own custom validation using the gform_validation hook. You'd have to query your data to see if an entry exists with that value and that users email address (or user id if you are going by a logged in user) and trigger validation if there is a duplicate.

    A tutorial on how to use the gform_validation hook can be found here:

    http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_valiation%22_Hook

    Ultimately you'd have to write the custom code necessary to do this type of validation, the tutorial is only going to provide you an example of how to use the gform_validation hook itself.

    Posted 13 years ago on Monday July 18, 2011 | Permalink
  7. Hi guys!

    Thanks for this solution. It works for now but I would love to have the ability to test for duplicate post title as a checkbox! Carl, you said that you would look into it, how is it going? :)

    Posted 12 years ago on Monday February 27, 2012 | Permalink