Gravity Forms make Address field unique

1k views Asked by At

Most of the fields in Gravity Forms allow you to check a box for unique entries, meaning no other entry can have the same info in that field. For example an email field must be unique to all other entries for that form.

I am trying to do the same thing with the Address field. I want to see if the street address (or entire group for that matter) has been input before and if so, give the user a warning, and not let them submit.

Any suggestions since this is not built into that field?

1

There are 1 answers

0
Dave from Gravity Wiz On

This snippet will allow you to limit the entire address as a unique value.

http://gravitywiz.com/better-limit-submission-per-time-period-by-user-or-ip/

You would configure it like so:

new GW_Submission_Limit( array(
    'form_id'  => 871,
    'limit_by' => array( 'field_value' ),
    'fields'   => array( '16.1', '16.2', '16.3', '16.4', '16.5', '16.6' ),
    'limit'    => 1
) );

You would need to change "871" to your form ID and all the "16.1", "16.2", etc to your address field input IDs. Only the "16" will change to your field ID.

Happy to answer questions on this. :)