function hook_matrixvalidate in Matrix field 6.2
Parameters
$fieldname string The CCK field name:
$element The entire element object:
$row_index the row position of the cell in question:
$col_index the column position of the cell in question:
Return value
TRUE if the cell passes validation or a string which should be returned as the message to the user
1 invocation of hook_matrixvalidate()
- matrix_validate in ./
matrix.module - Validation callback This checks that required fields are filled in. Calls form_error on elements which are not filled in
File
- ./
matrix.module, line 863 - Defines simple matrix field types.
Code
function hook_matrixvalidate($fieldname, $element, $row_index, $col_index) {
switch ($fieldname) {
case 'my_field':
if (strtouppr($element[$row_index][$col_index]) != $element[$row_index][$col_index]) {
return t("Please only use uppercase letters");
}
else {
return TRUE;
}
break;
}
}