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

Form URL validation - strange behavior #1318

Open
Budry opened this issue Dec 20, 2013 · 8 comments
Open

Form URL validation - strange behavior #1318

Budry opened this issue Dec 20, 2013 · 8 comments
Labels

Comments

@Budry
Copy link

Budry commented Dec 20, 2013

Hello,
if I use Form::URL rule, validator return true though string in input isn't valid url in my opinion.

$form->addText('url')
    ->addRule(Form::URL, '');

Example for input "aaaaaa" validator return true (IMHO "aaaaaa" isn't valid url)and form is sended with url "http://aaaaaa"
This is bug or some feature?

@dg
Copy link
Member

dg commented Dec 21, 2013

In fact, http://aaaaa is valid URL, like http://localhost. But it would be more pragmatic, if a form validator will require a dot in address.

@TomasVotruba
Copy link
Contributor

@db: Indeed. Should I implement it into both server and client validation?

@dg
Copy link
Member

dg commented Jan 9, 2014

It is question. Usually you want http://cs.wikipedia.org/wiki/FQDN with http(s) protocol, but there are cases, when any hostname/ipv4/ipv6 is correct (form for setting database, local pathes, ...). Maybe we should have Form::URL for http FQDN urls and Form::HOSTNAME­…

@TomasVotruba
Copy link
Contributor

Where would be Form::HOSTNAME used?

@mishak87
Copy link
Contributor

@TomasVotruba as @dg stated mostly in forms with settings or configuration details.

:+1 for separate FQDN and HOSTNAME

What about IP(v4)? and IPv6? These could be useful too (PORT can be simulated by number with range). Also it would be good opportunity for improving IPv4 regex \\d{1,3}\.\\d{1,3}\.\\d{1,3}\.\\d{1,3} because it is a bit dull.

@TomasVotruba
Copy link
Contributor

@mishak87 I would like to know more ideas about this topic, just to be sure, what do you expect or need.
So far we've got:

Anything else?

@mishak87
Copy link
Contributor

FQDN for domains only (no protocol or port)

@pavelkouril
Copy link
Contributor

HOSTNAME shouldn't contain the "http://" part though? Hostname should be just "example.com" or "example"?

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

No branches or pull requests

5 participants