sorry for the ominous title.. but.. hey...

Have the creators/contributors of CCK heard of (and used) Blueshoes (www.blueshoes.org)?

Blueshoes, among many other things, includes an incredible set of php form classes for building very intelligent forms. They have a very impressive set (see snippet from VAR description on my site at www.LiquidCMS.ca/blueshoes_form) of form field validation and manipulation functions.

What the heck am I talking about you say??? A few examples:

Validation:
must – simple enough, field must be filled in
mustIf – field must be filled in if another field is filled in (text field) or selected (checkbox)
mustOneOf – at least one of the field in this set must be filled in

and a few more:
var $onlyIf;
var $onlyOneOfIf;
var $minLength = NULL;
var $maxLength = NULL;
var $mustStartWith = NULL;
var $notStartWith = NULL;
var $mustEndWith = NULL;
var $notEndWith = NULL;
var $mustContain = NULL;
var $notContain = NULL;

and a couple VERY powerful ones:
regularExpression – entered data must match a regexp
additionalCheck – some php code that must pass – you really need to think a bit to get the amazing power of this one, e.g. “has this value already been entered in the database”

Manipulation:
trim
replace
remove
case – change case: for example “always capitalize a postal code”, option for ucasefirstonly, etc

So my questions for the CCK community:

- am I wrong in thinking that this would massively improve the functionality of CCK?
- is CCK designed in such a way that validation/manipulation “options” could be added to fields?

Unfortunately Blueshoes is not OS but mostly what I am suggesting here is having hooks in CCK to allow the start of a cck_validation module and cck_manipulation module (at least I think that is what I am getting at??).

Also, Blueshoes doesn’t just add these abilities to simple text field form items – for example on one of my sites I have a BShoes date field which uses a BShoes popup calendar field to enter birthdate – but the site requirement is for users to be over 18 years old – using the additionalCheck function I am able to make a sliding (with the current date) requirement for a birthday entry that matches with the 18 yr old age requirement. The options are limitless.

CCK rocks – there is no doubt about the power that this adds to a CMS to be able to auto-build database space to match with custom forms. But, if CCK is going to step beyond just a neat way make some “simple” forms to being a truly useful tool for real-world data entry applications – I think the concepts of user defined validation and manipulation must be considered… well, IMHO anyway.

Peter Lindstrom
LiquidCMS - Content Management Solution Experts

Comments

morphir’s picture

Title: The Future of CCK ??? » A good idea. now code it!

CCK already have some validation, with word counts. But the form manipulation is quite interesting I think. It's really no question whether you can make it or not. The question is, can you make the code? Or do you expect JonBob to program these sets of modules?

I suggest you start designing the module, and put together some code. If you are willing to work on it, you will get help under ways:)

liquidcms’s picture

Title: A good idea. now code it! » Future of CCK ??

I might be up for doing the code.. at some point. But wouldnt start unless i saw some concensus that this was the logical direction for CCK to head.

Yes, i do know that some of the fields have validation rules assigned; but i think in a way that is part of what i am suggestring is the wrong philosphy. The goal would be to have "field options" defined and then assignable to individual fields - exactly so that it doesnt need to be redefined for each field type that comes along. Not entirely sure what the UI for this approach looks like - Blueshoes simply builds form elements as an object by adding VARs to it - in which case you can easily add as many of these "options" as you need (and in whatever order is required) - for example: convert to lowercase, trim to a length of 6 and then check the database.

and, please don't change my title :)

morphir’s picture

Sorry about changing the title. That was not done by purpose, but by an accident. Anyways, I agree in your philosophy when it comes to have cck AS and extended framework for Drupal. And I think that is the genuine philosophy for JonBob behind CCK and Flexinode, that it should give you options, and scale in whatever direction you want it too. My point is, that this sounds like a very good idea(!). And when you or someone else start to realize those thoughts, by writing 'some' code, this will often make the boat start floating, and people will attend. Just throw out some code. And programmers will catch up on you.
Another thingy, the code have to be mature before JonBob will accept the code into the cck-project(as fields/or cck modules).

In general there are a lot of features/modules people want to see in drupal(better bulletin board, better image handling etc.), but the real problem boils down to one thing, manpower. You can't seem to get enough programmers these days :)

That is why, we have to scratch our own itch some times. Hope you get my point here.

Great to see you are researching other CMS-solutions out there. There are no doubt we can learn and then maybe adopt a thing or two.

karens’s picture

Status: Active » Closed (duplicate)

There is already an issue on validation at http://drupal.org/node/52051. I'm marking this as a duplicate, but you can add anything appropriate to that issue.