Okay, perhaps I'm just easily confused, but I cannot make heads or tails out of form validation.
I am attempting to perform validation on a field that has been added to an existing form.
I've added a textfield to the form that appears on admin/settings/content-types/(nodetype), and I want to be able to make sure that a positive integer is entered into that field.
I'm attempting to create a very simple module to limit the number of nodes that can be created per user, per node type, and I wanted to add a field to the admin/settings/content-types/(nodetype) page, where the admin could enter an integer for how many nodes of that type that each user could create.
Now, the easy part was creating the alter_form thingy, to add the appropriate field to the form. I got that working just fine. It saves to the database properly and everything.
But then I wanted to make sure that the admin entered an a positive integer or zero. Glancing through the API, I'd seen an attribute for form elements, "#validate", and thought it would be simple. Here I sit, eight hours later, completely frazzled.
The sample code on the Forms API Reference page either doesn't work, or I completely don't understand it.
The code in the Forms API FAQ entry (http://drupal.org/node/36899) under "How do you use the #validation arguments?" doesn't even _look_ like it would work (no quotes around #valid or #validation arguments)