backdrop-contrib / webform

For making surveys and forms in Backdrop.
GNU General Public License v2.0
13 stars 12 forks source link

Enhancement: Link field to not require https:// #236

Open albanycomputers opened 1 month ago

albanycomputers commented 1 month ago

I'm getting a lot of people having trouble filling in links... A lot of people are unfamiliar with entering https://

Can the functionality be updated to allow links without https://

Many thanks.

albanycomputers commented 1 month ago

In the file core/includes/common.inc

function valid_url - line 1427

The two parameters are

herbdool commented 14 hours ago

There are two layers of validation:

  1. It uses the <input type="url"> element which browsers will validate. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url. It will accept things like:
ssh://user@example.org
mailto://user@example.org
http://example.org
file://c
ftp://user@example.org
feed://example.org

But it will not accept domains without the prefix. It still requires ssh://, mailto://, https://, http://, file://, ftp://, feed://.

  1. valid_url() function in Backdrop which is a bit stingier. If $absolute = TRUE then it will only check ftp://, http://, https://, and feed://. So it's an option to disable that check, but the browser would still not allow someone to enter example.org without a prefix.

So I don't think that's going to fit your request if just the one check is removed.

Both would have to be optional. And in that case, maybe just use a regular textfield?