Attached patch adds the following line about the form id to the Forms API quickstart guide.
Because the form ID can be used in functions, you have to make sure it is a valid PHP label. A valid form ID starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
Though form IDs do not have to be valid PHP labels per se (see eg CCK), invalid form IDs break a good deal of FAPI.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | fapi_valid_formid_0.txt | 2.21 KB | heine |
| fapi_valid_formid.txt | 2.19 KB | heine |
Comments
Comment #1
heine commentedstatus (though it's not exactly code)...
Comment #2
Gary Feldman commentedAs written, that's a non-sequitur. Any string can be used within a function without being a valid PHP variable name. I think what you mean to say is more like:
Gary
Comment #3
RobRoy commentedI think dashes would be a big mistake as well:
Comment #4
heine commentedThanks, function names is indeed what I meant to say. Attached a new patch.
The sentence "A valid form ID starts with a letter or underscore, followed by any number of letters, numbers, or underscores." indicates that spaces and dashes are not allowed.
Comment #5
coltraneBump, this still isn't documented from what I can find and I just ran into it. drupal_get_form() takes one argument now.
Comment #6
betz commentedComment #7
jhodgdonThe patch doesn't apply any more for Drupal 6 or 7 (the doc has been changed slightly). But I've added the above sentence, more or less, to the doc for D6 and D7.
Changes checked into the contrib repository today; should show up on api.drupal.org within a day or two. See http://drupal.org/cvs?commit=229292 and http://drupal.org/cvs?commit=229288
Comment #8
jhodgdon