I am trapped with custom cck validation in my content type
I have a float price field, if i add space in the price field Drupal say confidently the field is not valid, i want to add function to remove the space before the default drupal cck validation, could anybody help
i tried with form alter and adding a validation handler but that is failing.
my form id is trade_result_node_form and the form alter contain the following code
case 'trade_result_node_form':
$form['#validate'][] = 'bz_custom_traderesult_form_validate';
$validate_array = $form['#validate'];
$validate_reversed = array_reverse($validate_array);
unset($form['#validate']);
$form['#validate'] = $validate_reversed;
break
function bz_custom_traderesult_form_validate($form, &$form_state) {
$form_state['values']['field_trade_entry_price'][0]['value'] = trim($form_state['values']['field_trade_entry_price'][0]['value']);
}
Thanks for reading the post
Comments
briefly you shoud try to follow these steps
if your custom module name is for example 'validator'
i think that your module name is bz but anyway you could replace the
validator_bz with bz ( dont forget the leading _ when its needed )
then inside your validator.module file you should have :