I have used url validation code in my model,but it gives me error. I just validate if user only put like google.com or yahoo.com not http,www required. How i can do this.
[['thankyou_page_url','confirmation_page_url'],'url'],
I'm not able to test it right now. But I think you need to add the defaultScheme
option. The default value of defaultScheme
is null
which means there must be a valid scheme in the URL.
If you change it to
[['thankyou_page_url','confirmation_page_url'],'url', 'defaultScheme' => 'http'],
the http:// part will automatically be added if you don't supply anything in the input. I think if you set the defaultScheme
to an empty string it will also allow URL's without a scheme. So maybe this works:
[['thankyou_page_url','confirmation_page_url'],'url', 'defaultScheme' => ''],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With