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.

Unique code for each response

  1. We are running a contest where we'll have many entries coming in and with each entry attachments. What we want is a hidden field that will give each entry a unique number.

    We'll have 5 categories, so the number would be depending on the form that is used, "FA4321"

    where the "FA is the name of the category and the "4321" are randomly or sequentially assigned.

    We need this since people might register in more than one category and we would like to link all their entries by a number to one person.

    I hope this is clear, though I'm sure i"ll need to help explain further. The key though is to get a id number for each submission.

    Thanks

    Posted 13 years ago on Tuesday November 30, 2010 | Permalink
  2. Here is a post with a code snippet that does something similar. It populates a hidden field with a unique id. You can customize the code snippet to suit your unique id needs.

    http://forum.gravityhelp.com/topic/guid-entry-id#post-3993

    Posted 13 years ago on Tuesday November 30, 2010 | Permalink
  3. awesome but is there any simple way to add a prefix based on which form it's coming from?

    Posted 13 years ago on Tuesday November 30, 2010 | Permalink
  4. Using this:

    if ( function_exists('register_sidebar_widget') )
        register_sidebar_widget(__('Search'), 'widget_webdemar_search');
    
    add_filter("gform_field_value_uuid", "uuid");
    function uuid($prefix = '')
     {
        $chars = md5(uniqid(mt_rand(), true));
        $uuid  = substr($chars,0,8) . '-';
        $uuid .= substr($chars,1,4);
        return $prefix . $uuid;
      }

    and excuse my ignorance, but can I add something here: function uuid($prefix = 'xxxxx')
    that would insert a word from the form that they are currently submitting?

    thanks

    Posted 13 years ago on Wednesday December 1, 2010 | Permalink
  5. Yes, you can basically do whatever you want with it but you would need to know PHP and be able to write the custom PHP to do so.

    Posted 13 years ago on Wednesday December 1, 2010 | Permalink