Here's a possible workaround. Time will tell if it breaks something. I have only tested on OSX versions of the latest Chrome, Firefox, Safari, and Opera, and not yet on a production site. Note that it probably disables browsers' validation of all HTML5 fields in the form.
- The function my_novalidate() disables browsers' validation of HTML5 fields like input type="url" fields. Without disabling, I think some browsers (Chrome/Firefox) block the form from even being submitted if "http://"" is missing -- not a Gravity Forms issue, because GF never even receives the data. Opera just adds the http://. Safari doesn't care about missing http://, but then GF will invalidate.
- The function my_protocol() then adds "http://" if the user omitted a protocol. This happens before the field value makes it to GF's validation procedure.
Here are my settings for making this work.
- GF 1.6+ (I'm on 1.6.12)
- HTML5 enabled everywhere
- Use website field type (instead of text field). This uses input type="url" (vs. type="text"), which may have advantages of bringing up custom keyboards on mobile devices.
- Don't set up any kind of dynamic population of "http://"
I hope the code isn't too long here -- some dislike links to code on external sites.
GF admins: If the code above is helpful, would it be appropriate to put a link to this post in past related threads here and here, for those coming across those posts while looking for ideas on this issue (like I was)? Maybe this is all beyond the scope of the forums.
Posted 12 years ago on Thursday February 28, 2013 |
Permalink