This patch is to add support to validate fields using php code. This helps the
coder to write advanced validation code for cck text field. After patch
there is a new php code textfield created where we can put our validation code.
And if the field value provided is valid then we can return true, false otherwise.

Validation code example:
========

/* accessible variables : $node, $field, $item */
/* test the $item["value"] */
if(preg_match('/^\w\w*\.\w\w*\.\w\w*$/', $item['value'])) { /* see if www.sf.net for example */
return true; /* it is valid */
}
return false; /* not valid */

=========

I hope this will provide more freedom of validation to the coders :) .

CommentFileSizeAuthor
text.module.patch2.05 KBkamanashisroy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mjlF95’s picture

I'm trying to do this very thing in Drupal 5.x. I am running version 1.7 of CCK and I checked the contents of this patch against the text.module and it seems like it's been implemented in 1.7. However, I tried the above example code and it did not seem to effect validation (both www.xxxx.yyy and non-www.xxxx.yyy validated). Any advice?

KarenS’s picture

Status: Needs work » Closed (won't fix)

Too old now, way past the time when we will add features to D5 version.

kenorb’s picture

kenorb’s picture

Status: Closed (won't fix) » Closed (duplicate)