Jump to content

PHP Form Validation Against CSV with Wordpress


JessicaBBG

Recommended Posts

Hi all,

 

PHP newbie here. I've been trying to integrate Gravity Forms with Gravity View's Import Entries from CSV plugin. Unfortunately, it needs a bit of tweaking to get everything connected properly.

 

I used a code snippet from David at Gravity Whiz, (HERE) that gets integrated into my Wordpress site's functions.php file, and have been trying to customize to to suit my needs. From what I understand in looking at the code, the only bit I need to tweak (I think) is the bottom portion:


# Configuration
 
new GW_Value_Exists_Validation( array(
'target_form_id'  => 1,
'target_field_id' => 3,
'source_form_id'  => '/RSVPcodes.csv',
'source_field_id' => 'rsvp',
'validation_message' => 'Hey! Don\'t be a villain! Provide a legit RSVP code to reserve your spot at the Smackdown.'
) );

My main question here: how to get the validation code to see the database that I've uploaded via the Import Entries plugin? I know ignorance is making me miss something that should be pretty simple. Right now, I've got it to validate a test word that I know is not in my database, and also a code that I know is in the database. It's coming back with both items as not valid.

 

The end result will be a RSVP form that will be used to accept RSVPs only from people who have an RSVP code from their invitation, a lot like a license key validation system.

 

The live site (and form I'm trying to tweak) is HERE.

 

Thanks in advance for any help.

Link to comment
Share on other sites

The function you linked to via gravitywiz seems to be a function used to validate one form's field against another, not as a lookup system using CSV. If anything I would expect you to have to use a CSV import utility to put the RSVP numbers into the backend and then use the function to compare two forms.

 

I don't know gravity forms at all, I'm just going based off what you posted above and the page you linked to.

Link to comment
Share on other sites

Thanks iarp,

 

After a lot of tweaking, I've managed to get everything validating properly. I had the wrong settings for 'source_form_id' and 'source_field_id'.

Now, the final step is to make it so each code can only be used one time.

 

Has anyone had luck with this kind of thing? 

 

Also, I had to password protect the site to keep people from RSVPing prematurely. Pass is bbg2314 for those interested in viewing.

–J

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.