Posted by sewid on June 12, 2010 at 1:06pm
Hi,
I want to display a custom form in a block.
My block:
function my_module_block_view($delta = '') {
switch ($delta) {
case 'my_block':
$block['content'] = drupal_get_form('my_module_test_form');
break;
}
return $block;
}My form:
function my_module_test_form() {
$form = array();
$form['any_value'] = array(
'#type' => 'textfield',
'#title' => t('Insert a value'),
'#default_value' => '',
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Do it'),
);
return $form;
}Submission code:
function my_module_test_form_submit($form, &$form_state) {
drupal_set_message("Form submitted");
}When I try to submit the form, I get an error message because of the execution time is greater than 30 seconds, sometimes I also get a memory error, that the maximum memory (64MB) is too less. If I try to load the form on a single page and disable the block, everything works fine.
Any idea, what there is wrong?
Best regards,
Sebastian
Comments
As an addition: If I reload
As an addition: If I reload the page after I got the error message, I see the message "Form submitted" about a hundred and more times. It seems, that there is an infinite loop after submitting the form, the question is now: why?
Ok, it seems to be a problem
Ok, it seems to be a problem of the devel module, so I will raise an issue there. When I disable the devel module, everything works as expected.