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.

Service Area Search - Different emails

  1. I've looked everywhere and since I own Gravity Forms thought I'd try here. I need a simple widget that allows potential customers to enter their zip code and have one of three things happen:
    If input of zip code is within a given number range (range 1), the visitor gets an input form to ask for a quote from sales rep 1

    If input of zip code is within a given number range (range 2), the visitor gets an input form to ask for a quote from sales rep 2

    If input of zip code is outside of range 1 or 2, the visitor gets a message display stating that we are sorry but we do not service their area.

    Can anyone help me figure this out? Can it be done with Gravity Forms?

    Posted 7 years ago on Friday August 10, 2012 | Permalink
  2. I was taking a look at this today. Are the two zip code ranges sequential? For example, 10000-11999 is range one, and 12000-13500 is range two, or something like that? It matters for the conditional logic. If they're not sequential, we'll have to do something different than what I was planning.

    Posted 7 years ago on Sunday August 19, 2012 | Permalink
  3. Please take a look at this form:

    The XML export of the form can be downloaded here so you can see how it was done.

    ( or direct download the XML source )

    Download that and import the form into your installation as an example.

    If you have any questions, please let me know.

    Posted 7 years ago on Sunday August 19, 2012 | Permalink
  4. Chris, Sorry for the delay... My macbook pro is in the shop AGAIN so I'm working from my pc and its taken a bit to catch up.

    Response to first question. The two zip codes ranges will be considerably different as both are in different states. Knowing how zip's work it's not likely that they will even be a range within a given territory. For example, CA may be something like this 91001, 91011, 91214 etc.

    Seeing the form you created could certainly work with enough entries. The advantage is that consumers don't get frustrated entering their zip only to get a "sorry charlie" note.

    Ideally, regardless if all ranges are displayed or if there is an input field, the result would be a contact email form that routes to the appropriate salesman (I think that's what your form must do).

    If need be, I could have two different input forms (one for CA and one for TX) and each one tied to the appropriate salesman email. This would allow for only one of two possible conditions (1) email form (2) sorry, we don't service your area message. Of course if I display all the zip's there is no need for #2.

    In closing it might be a long term disadvantage to list all zip's as a large territory could have a dozen or more and the overall size of the input area would be too big, certainly outside of a wordpress widget.

    An example of this input that works in Joomla can be found here: I have no idea how it was done as Joomla is a mystery but you'll see the functionalty in the top right widget. Test it with these two zip's 91001 and 91214.

    Thanks for the help. I look forward to your reply.

    Posted 7 years ago on Monday August 20, 2012 | Permalink
  5. You stated ranges in the first post, so I was going with that. If you're not using actual ranges, but a defined list of values to compare against (for example, if the ZIP code is in array(91001, 91001,91214,60546)) then we need a different approach.

    In that case, you might want to consider two forms, the first one a pre-qualification, where the ZIP code is the only thing requested. The visitor submits, and you validate the number that was entered against your list of service ZIP codes. If there is a match, send them to form 2 with the ZIP pre-populated. If there is no match, you don't service the area, then just show them the "Sorry" message.

    Would that approach work?

    If not, you could also do client-side validation after they enter the ZIP code. Show the error message right away, or unhide the rest of the form if you service their area.

    The Joomla page is using client-side validation as a pre-qualification to see the real form.

    Posted 7 years ago on Tuesday August 21, 2012 | Permalink
  6. If I understand your comment, the difference between the two approaches is that in the first one (using two forms) the visitor enters a zip and regardless of a match or not they are passed to a second form... either a sorry message or something generated by a successful match. In the second one, there is client-side validation and it's all contained within one process. Is that a correct understanding of the difference?

    It sounds like either would be sufficient so I'm OK with whatever is easiest and the most flexible. Of course if there is a match I'd like to thread the 2nd form to one of two different salesmen so really there are 3 possible resulting forms after a match - Salesman 1 email, Salesman 2 email and of course the sorry message.

    Do I have it right? If so.... how the heck do I make it happen. I'm a newbie to Gravity forms but not a novice with database constructs so am therefore only partially clueless. :)

    By the way, thanks again.


    Posted 7 years ago on Tuesday August 21, 2012 | Permalink
  7. I'm afraid I'm not feeling the love. Any chance I can get a response to this issue so I can determine where to go from here?


    Posted 7 years ago on Friday September 14, 2012 | Permalink
  8. Sorry, this topic scrolled off the radar.

    Going back to the beginning, your ranges of ZIP codes are not contiguous, are they? You stated range initially, but really, you want to verify if an entered ZIP code is in a list of ZIP codes, correct?

    In that case, you need to validate the ZIP code the visitor entered, and compare to your list of ZIP codes. If there is a match in one list, return salesman one contact information to use in the email notification. If there is a match in the other list, return the salesman two contact information. If there is no match, return the "sorry" message.

    You can use the gform_validation filter to see if the number that was input matches either or neither of your lists of numbers.

    You will have two possible successful matches, and one possible validation failure.

    I've done this before, comparing the user input to a list of numbers in a text file. This topic:

    and specifically this post:

    There are quite a few moving pieces to it and it will require some work. Let us know where you get stuck.

    Posted 7 years ago on Saturday September 15, 2012 | Permalink
  9. Chris,

    Thanks for the reply. You summarized it accurately. I will follow the links and begin the process of setting it into motion based on your examples. Thanks again, I will indeed let you know if I have issues. Cheers.

    Posted 7 years ago on Sunday September 16, 2012 | Permalink
  10. I believe I wrote the code in the "database lookup" replies, so if you need help I will be happy to help you with it. It's a little different scenario than was first described, but it's still entirely possible. We just need to use a different approach than was initially planned.

    Posted 7 years ago on Sunday September 16, 2012 | Permalink
  11. I ran across this code today while looking for something else. It seems to be just what you're looking for?

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink