How can I change the precision in the decimal field of CCK?
yeah, _node_validate is a flexible way. an alternative to a custom module, can be use a Rules module and integration with Rules Forms support module. Also will be useful use a more flexible CCK field, then, this will allow to validate whatever number with the model that you want.
.1. install the modules.
.2. then we need now is indicate to rules in what form must work. You must go to Rules &gt; Form events and enable the option Enable event activation messages on forms. then go to the respective form and click in the Activate events for.. (the name of the form)
.3. go to rules and add a new rule and select in the Event: the respective event on which you want to evaluate this rule. (to this case Rules Forms modules will include the name of your form in the Rules Forms section on the Event select list.
.4. In a condition of rule add a numeric comparison (or whatever other condition that you want, for example a custom php code):
example with numeric comparison:
field Number 1 (php code): $number= $form_state['values']['number'][0]['value']; if ($number &lt; 10 || $number &gt; 100) { echo 1; }
Field Comparison: Equal to
Field Number 2: 1
.5. in the action option, of your rule, add an action like a form error message to warn about change the syntax of the number. in Form element ID add the ID of the field, for example field_color (you can review the name in the list of fields CCK of the content/node type).
.6. Create a new rule if is necessary, like $number= $form_state['values']['number'][0]['value']; if (...) { echo 1; } and add the respective error message.
do not forget enable the rule, to see working your rule!.
(I hope that this information be useful)