AlexA
AlexA

Reputation: 4118

Drupal: Custom Content Type validation

I've created a custom content type with CCK.

If I need to add some custom code for validating fields of this content type's record form, where do I add the code and which functions are best for this task?

Upvotes: 2

Views: 4279

Answers (3)

jem
jem

Reputation: 9

To create your own module to implement form validation I suggest this method: create a new module for content type field validation in drupal

Upvotes: 0

googletorp
googletorp

Reputation: 33285

The easiest way would probably be hook_form_alter() and the #validation attribute on the form. You would of cause have to implement this in your own module.

Upvotes: 6

John Lewis
John Lewis

Reputation: 722

The form api is what you use to validate, you'll be crafting your own validation function. I'm going to assume you are using D6

There's a less painful way: http://drupal.org/project/validation_api

This module lets you make php code or regex for any given field.

Hope this helps.

Upvotes: 3

Related Questions