I have a node of test type. User creates another node of credit type that references test.
Credit node has field credit_test_credit that is the number of hours the user earned on node Test.
Easy enough. The problem is, I don't want the user to claim more credit than Test->max_credit_hours.
I tried php in the allowed values of the cck field credit_test_credit, but since the node isn't saved, drupal doesn't know what node it references yet.
I can use hook_nodeapi and validate the field credit_test_credit and make sure it doesn't exceed test->max_test_credit, but I want the user to know BEFORE he fills out the field what the allowed range is. (1,2,3,4,5) for example.
I could make ANOTHER custom node, but I have other fields in node credit such as filefield that make using cck the way to go and much simplier.
Is there a way to add a single field to the cck node credit, that will offer an acceptable range to the user?
Possibly, hook_form_alter? I have never used this, but off hand it seems like the thing, and I am goign to the API now to read up on it.
Any suggestions appreciated!
Comments
okay so hook_form_alter might
okay so hook_form_alter might seem like the way to go.. Still tryign to figure out how I find the name of a form, any form, in drupal, the easy way.. say for example, the edit node form for node of type credit? :)
Also, using hook_form_FORM_ID_alter might be more appropriate? How do I decide?
Again, many thanks.