4

I have link CCK field but the field does not validate "HTTP://" like this enter image description here

how I can make the validate "HTTP://" for this field

4 Answers 4

4

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

3

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.

3

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...

0

i do it by using this model advanced_link in drupal model, thanks all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.