DOCUMENTATION

  • Developer
  • Submissions
Search »

ft_api_check_submission_is_unique

This function lets you check that a submission is unique, based on whatever criteria is required for your form. For example, a common usage of this function is to check that a submission currently being placed has NOT already been placed by someone with the same email address.

The function has the following structure:

The $form_id parameter is self-explanatory; you can find this value in your Form Tools interface. $criteria is a hash (associative array) where the keys are the database column names and the values are the values being examined. This field can contain any number keys. The third $submission_id parameter is OPTIONAL, and was added in version 20090905 of the API. This lets you tell the function to ignore a particular submission when doing to the comparison. In other words, it ensures that it doesn't run the test for uniqueness against itself - because that would always fail!

To return to our example, imagine you want to check that a submission hasn't already been placed by a user with a particular email address. You could check like this (where "email" is the database column name and the form ID is 10):

N.B. we chose to use database column names rather than form field names to allow you to also use the system fields (is finalized, IP address) to check to uniqueness. You can find the database column names on the Edit Form ยป Database tab.