简体   繁体   中英

form inside a block in drupal 7

I am placing a form inside a block in drupal with the following code

function current_posts_block_view($delta = '') {
  $elements = drupal_get_form('mydeveloper_simple_form');
  $block['content'] = drupal_render($elements);
}

This block is displayed in footer. The form has required field validator in it. So if I submit the form with no data the validator will work and error is displayed, in the default place in the node where the error will get displayed. (on the top of the page) I want it to be displayed inside my block. What should I do for that?

The reason is that, all errors, information, and status messages are displayed where you have set in the page.tpl.php in your theme. You can try Inline Form Errors module, http://drupal.org/project/ife/ , to fix this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM