Let's suppose I have a content type Person, and I don't want the field Name to contain the text AAA.
What would be the best way of avoid submitting the form if that happens?
- Hiding the Save button
- Submitting it, but return to the same page with that field marked as red, or just show a message...
This is just an example. I'm asking it because sometimes I need to do a query to the database and see if some records exist, or something like that...
I have edited the
template.php file under the theme folder I'm using, and I have added the functions:
In the 2nd function, I've modified the form to see Drupal is calling this function, and yes, it works...
Then I did the following in the 2nd function:
$form['#validate'] = array('my_validate_function');
my_validate_function($form, &$form_state) I just wrote
form_set_error('', t('Testing...')); and nothing seems to be happening: I can still create a new content without problems :(
What am I missing here?