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.

Is there a way to automatically prepend the "http://" to URLs...

  1. ... when using the Website form field? It seems I have a fair number of people who don't seem to understand any instruction that tells them they need to include http:// when entering their URL.


    Posted 9 years ago on Friday December 14, 2012 | Permalink
  2. David Peralty

    You could use the following hook and some PHP to do what you want:

    You'll need to test to make sure they didn't already put the HTTP in place. All my best!

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  3. Thanks. Is there a way for someone who's not a developer, but who's reasonably adept at reading code and perhaps changing a line or two, to do this? ;-)

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  4. David Peralty

    With a reasonable amount of research, you might be able to do this.

    You will want to use the hook I already linked to grab the data the use submitted. Then you will want to use PHP to test to see if the string http exists. If so, do nothing. If not, then prepend the URL with the relevant information and pass it back to Gravity Forms.

    Almost everything you need to do this is available through some simple Google searches and changing a line or two.

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  5. Thanks. I'm running a business with barely enough time to do much of anything other than keep up with my production schedule, let alone what it would take to do reasonable research and learn enough about a generic bit of PHP to make sense of the hooks and then test to make sure I didn't screw anything up. The fact is, I came to the support forum for, well, support because I made the (now clearly erroneous) assumption that this is where experts with the plugin are available to help licensees (ie. paying customers, who presumably have varied levels of expertise) solve problems. I didn't expect anyone to hold my hand. But I also didn't I expect someone with the title of Administrator to read the part about me not being a developer and assume it meant I had enough expertise that I could simply turn to the Internet-at-large to fill in the blanks, either.

    I do, though, appreciate you taking the time to answer.

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  6. David Peralty

    We do provide support, and if Gravity Forms is broken, we will do all that we can to fix it, but we don't give out custom code often because it ends up being more of a problem and not all of our support personnel are able to then provide support when custom code breaks or needs to expand to fit more advanced features.

    If you want customizations to Gravity Forms, there are plenty of developers that can help you with this. We even have a Job Board section on the site to post such needs.

    Don't get me wrong, I understand your frustration, but when you mentioned you would be willing to swap out lines of code to get things to work, I tried to point you to the resources that you would need to build such a script. I'm sorry that it isn't what you wanted. I hope you'll be able to either find the time required to develop this customization or find a developer that can help you do what you want.

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  7. First, the name of the forum is Gravity Forms Support, not Gravity Forms is Broken Support. Besides, as far as I knew, my form was broken. And I most certainly had no inkling that this required custom code. Had you included the first paragraph, starting from "we don't give out custom code ...," in your last reply along with what you wrote in your original reply, then everything would've been aces.

    Posted 9 years ago on Friday December 14, 2012 | Permalink
  8. David Peralty

    rsiders - I'll remember that for the future. Thank you for your feedback.

    Posted 9 years ago on Monday December 17, 2012 | Permalink