Is there a way to completely override the CCK validation functions for specific fields?

When I use hook_form_alter to specify a validation function for a CCK field, it just adds my function to the CCK function. In other words, it runs both, and returns two error messages for the same field if the input has failed both validations. I would like to be able to completely bypass the CCK validations for some fields.

Thanks for any and all help!

Comments

sunnydeveloper’s picture

Is there any time at which you *do* want the other CCK validation to occur? What type of CCK field, what validation?

zbricoleur’s picture

Let's say I want to have a radio button. I want it to be required. But I want to validate it myself, because (a) I want a different error message, and (b) the custom error message is tied to something going on in another field.

sunnydeveloper’s picture

Make the radio button *not* a required field via CCK 'manage fields', then use hook_validate to manage validation? Assuming you are doing what I think you are.

zbricoleur’s picture

That was my default approach with D5. The problem is, when you make that field not required, CCK insists on putting another radio button in there ('N/A' or ' -None- '). In D5, it was easy to get rid of that superfluous button by resetting the #options array. But I have not been able to make it go away in D6 except by making the field required.

Also, more generally, there are times when I just want, for whatever reason, to be able to substitute my own validation routines for CCK's.

Thank you for the help though!