[documentation] [Documentation feature] form ID should be a valid PHP label

Heine drupal-docs at drupal.org
Wed Jun 21 18:15:29 UTC 2006


Issue status update for 
http://drupal.org/node/70027
Post a follow up: 
http://drupal.org/project/comments/add/70027

 Project:      Documentation
 Version:      <none>
 Component:    Documentation in CVS
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Heine
 Updated by:   Heine
 Status:       patch (code needs review)
 Attachment:   http://drupal.org/files/issues/fapi_valid_formid_0.txt (2.21 KB)

Thanks, 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.




Heine



Previous comments:
------------------------------------------------------------------------

Wed, 21 Jun 2006 01:06:12 +0000 : Heine

Attachment: http://drupal.org/files/issues/fapi_valid_formid.txt (2.19 KB)

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.




------------------------------------------------------------------------

Wed, 21 Jun 2006 01:12:36 +0000 : Heine

status (though it's not exactly code)...




------------------------------------------------------------------------

Wed, 21 Jun 2006 17:53:26 +0000 : Gary Feldman

"
Because the form ID can be used in functions, you have to make sure it
is a valid PHP label


"
As 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:


"
Becuase the form ID might be used to construct the name of a function,
it must be a valid PHP variable name.  It should start with a letter or
underscore, followed by any number of letters, numbers, or underscores;
spaces are not allowed.


"
Gary




------------------------------------------------------------------------

Wed, 21 Jun 2006 18:04:21 +0000 : RobRoy

I think dashes would be a big mistake as well:


"Becuase the form ID might be used to construct the name of a function,
it must be a valid PHP variable name. It should start with a letter or
underscore, followed by any number of letters, numbers, or underscores;
spaces and dashes are not allowed.

"




More information about the documentation mailing list