Drupal - link field does not validate http://

In drupal 7, go to your content type in:

/admin/structure/types/manage/yourcontentype/fields/

Edit your field and check if it is validating your URL. I have attached a picture for better explanation.

Link


I would have a look at clientside validation. Alternatively you could use hook_form_alter to add in your own validation by changing $form['#validate'] to point to your custom validator.

If you go down the programtic route and just want to check the format you could use PHP FILTER_VALIDATE_URL Filter function which would return true if its a url. Additionally, I would look at using CURL to verify the url actually exists.

Hope this helps.


In the D6 version at least, there is a checkbox for validating the link:

enter image description here

so I'd first make sure that's checked on your site before any custom coding...

Tags:

Entities