0

I am printing a webform block in my node.tpl.php:

  <?php
      $block = module_invoke('webform', 'block_view', 'client-block-72');
      print render($block['content']);
  ?>

And when I submit the webform with nothing, no error messages are shown. They are shown on the next reload.

If insert the block in admin -> structure -> block, it works fine.

Is there any way to make it work with inserted block in template file?

2 Answers 2

0

I've created a new region and inserted the webform block there.

0

The first time around, your module_invoke will generate a webform block for you. After submitting, assuming you return to the same code, it will do this again, but notice that there is a submission, validate that and if there is anything wrong with it, generate drupal messages internally.

However, since you're probably already deep in the page, the place where drupal messages are displayed is already passed at this point. Try this:

<?php
     $block = module_invoke('webform', 'block_view', 'client-block-72');
     // found errors ? dump m here !
     print theme('status_messages');
     print render($block['content']);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.