Reply to comment

This means drupal cannot find your callback to your form.
Possible causes:

1) Drupal cannot find your function because the php file containing the function is not loaded.

I had this problem when I tried to call the 'simplenews_subscription_list_add' form with.

<?php
drupal_get_form
('simplenews_subscription_list_add');
?>

It failed giving this error:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'simplenews_subscription_list_add' was given in C:/wamp/www/bvl/includes/form.inc on line 366.

The solution: Look at the menu hook in the simple news module calling the fucntion.
<?php
  $items
['admin/content/simplenews/users/import'] = array(
    
'title' => 'Mass subscribe',
    
'type' => MENU_LOCAL_TASK,
    
'page callback' => 'drupal_get_form',
    
'page arguments' => array('simplenews_subscription_list_add'),
    
'access arguments' => array('administer simplenews subscriptions'),
    
'file' => 'simplenews.admin.inc',
    
'weight' => -9,
  );
?>

This means the form is inside a file called 'simplenews.admin.inc'. So you need to load the file:
<?php
module_load_include
('inc''simplenews''simplenews.admin');
return 
drupal_get_form('simplenews_subscription_list_add');
?>

Now your form will be loaded.

2) You made a typo :)

<?php
//this will work
drupal_get_form('myform');

//this wont
drupal_get_form('my_form');

function 
myform() {
  
//form defined here...
}
?>

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><p><b><i><table><th><tr><td><blockquote><br /><img /><tbody><span><strike>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <codes>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.