By nevets on
Unless I am mistaken the Forms API needs to be used from within a module. I have a least twice now answered peoples questiion of their form not working when the code is provided as the content of a node. Logically that should not work since any form callback would not exist when the form iis processed after being submitted (the callbaclks would only exist after the node is loaded which happens after the form is processed.
So my suggestion for both the Quickstart Guide and Reference some where at the start add a note about the context in which the Form API can be used.
Thanks
Comments
Actually, I'm pretty sure
Actually, I'm pretty sure you can use the forms API from within the body of a node using the PHP filter. I've done it before for testing the API. You just name your functions the same way you would if it were a module. I posted an example at http://livetest.ubercart.org/node/64 with the following node body:
Granted there will be some breakdown, but I'm pretty sure even hooks like hook_form_alter() will work fine with this. I have no clue why it works. ; )
----------------------
Current Drupal project: http://www.ubercart.org
Actually, I believe form
Actually, I believe form processing only happens after your eval'd php calls drupal_get_form. I don't think there is any form processing before a page callback is called. So in the case of nodes, the node/nid callback calls node_page_view, then node_show/node_view renders the content and evals the code.
So when you submit:
Can you tell I can't sleep?
http://www.trailheadinteractive.com