[development] converting a module from Drupal 5 to Drupal 6

Earnie Boyd earnie at users.sourceforge.net
Wed Jan 21 19:38:36 UTC 2009


Quoting "Sheryl (Permutations Software)" <sheryl at permutations.com>:

>
> (1) What does $form_values['op'] refer to, and what does it mean if the
> value is not empty. (And how does Drupal 6 code this.)
>
> (2) How do I rewrite form_set_error('op', 'error message') for Drupal 6 when
> it's being set in response to a condition that has nothing at all to do with
> controls in the form?
>

When I'm debugging forms to understand the structures I use something like

drupal_set_message('<pre>' . print_r($form_values, TRUE) . '</pre>')

so I can see the contents of the arguments in the callback functions.  
The first argument of form_set_error should match the form element name 
being flagged with an error and is used in the form validate function.

You might be able to rewrite the form_set_error as ``form_set_error('', 
'error message')'' depending on what you need.  Also, take the deadwood 
comments with a grain of salt because the comment could be a false 
positive based on regular expressions.  Deadwood only gives a starting 
point, it doesn't do the whole job.

http://api.drupal.org/api/function/form_set_error/6
http://api.drupal.org/api/file/developer/topics/forms_api.html

HTH,
--
Earnie  http://r-feed.com
  Make a Drupal difference and review core patches.

-- http://for-my-kids.com/  -- http://give-me-an-offer.com/



More information about the development mailing list