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.

Limit User Input

  1. Hello,

    I am creating another form for a Non-Profit that I volunteer for. They wanted me to create a contest where the person puts in their name, email, phone, and contest code. They wanted the 30th person to receive a message stating they won, but after working with GF's for the last year I don't think that will be possible. Anyways They only want the contestant to be entered into the contest once. I setup the Email and "code" field to not allow duplicate entries. I however wanted to go a step further and limit the user input for the codes. The promotion codes will be given out at an event so I was wondering if there was a way to setup the "code" field to only allow the codes that we created?

    Posted 7 years ago on Thursday March 21, 2013 | Permalink
  2. You can use gform_validation to check the entered code against your list of codes (or, maybe it is just one code). I provided some code to do that previously: http://pastebin.com/7ANQh6Rc

    It was discussed in depth here: http://www.gravityhelp.com/forums/topic/database-look-up-validation

    You could notify the 30th entry for the form that they were a winner, but it would require custom code, counting the number of entries so far and then changing the confirmation if the entry is the 30th.

    Posted 7 years ago on Sunday March 24, 2013 | Permalink
  3. Chris, Awesome thank you! So I imported the code into my functions.php and changed the necessary components. The error message is showing up on "Enter Code" when I type in the wrong promotional code however it's still rejecting it if I enter the correct code. This website is hosted on a local hosting company server so I got that pathway from Duplicator settings panel. I set the file in the root folder just to test out the form /C:/ZPanel/hostdata/sco-oc/sco-oc_org/numbers.txt

    The only in the numbers.txt is 2013001

    Any suggestions?

    the form is on: http://www.sco-oc.org/stars

    Posted 7 years ago on Wednesday March 27, 2013 | Permalink
  4. Fixed it, I removed the /C: and now it works! How difficult would it be to customize the notification for the 30th entry?

    Posted 7 years ago on Thursday March 28, 2013 | Permalink
  5. Please open a new topic for the notification issue and we'll address it there. Thank you.

    Posted 7 years ago on Sunday March 31, 2013 | Permalink

This topic has been resolved and has been closed to new replies.