Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
albanycomputers opened this issue Aug 13, 2024 · 2 comments
Open

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

albanycomputers opened this issue Aug 13, 2024 · 2 comments

Comments

@albanycomputers
Copy link
Member

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
Copy link
Member Author

In the file
core/includes/common.inc

function valid_url - line 1427

The two parameters are

  • @param $url
  • The URL to verify.
  • @param $absolute
  • Whether the URL is absolute (beginning with a scheme such as "http:").

In the Webform link.inc

The $absolute value is set to TRUE... having an option to select either true or false would be more helpful.

The valid_url is based on RFC 3986 which has been replaced by rfc8820...

@herbdool
Copy link
Collaborator

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://[email protected]
mailto://[email protected]
http://example.org
file://c
ftp://[email protected]
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants