Third parameter for FORM::URL validation rule for tld

Notice: This thread is very old.
Grelek
Member | 233
+
0
-

Hello,

I think it could be useful feature. Normally FORM::URL marks URLs without tld as valid. I want to add third parameter (TRUE) that describes if we want “tld mode”, if not, leave third parameter blank.

addRule(FORM::URL, "Non-valid URL!"); // accepts www.bbc
addRule(FORM::URL, "Non-valid URL!", TRUE); // accepts only www.bbc.tld

// and the same with emails

BTW – sorry for my errors in english

Last edited by Grelek (2013-05-12 19:14)

Majkl578
Moderator | 1364
+
0
-

How would you identify (distinguish) TLD?

Grelek
Member | 233
+
0
-

I don't understand question. TLD can be distinguished with regular expression. If you mean how would I identify TLD (com, cz, net…), TLD can be pulled up from URL and compared with array of TLDs.

Majkl578
Moderator | 1364
+
0
-

array of TLDs

The problem is, there is no such array of TLDs, because TLDs are expanding, everyone can buy his own gTLD. See ICANN: http://newgtlds.icann.org/en/. So it can't be safely matched against some list, because this list is being extended every day.

Grelek
Member | 233
+
0
-

Ah. So it could be just checking, if any TLD exists, but it looks kind of useless.

Jan Tvrdík
Nette guru | 2595
+
0
-

Normally FORM::URL marks URLs without tld as valid.

Not true, in case of www.bbc is bbc the TLD.

Grelek
Member | 233
+
0
-

Jan Tvrdík wrote:

Normally FORM::URL marks URLs without tld as valid.

Not true, in case of www.bbc is bbc the TLD.

Oops, now I see it. But I meant that FORM::URL can identify TLDs. But now I see the problems, why it isn't implemented.