I created a new webform. Under webform setting it's asking me to fill the title (mandatory). I am not talking about the title for fields here. I dont want the title to be displayed when the form is displayed. how can i get rid of it?

Comments

quicksketch’s picture

All nodes must have a title, since the title is used to show the node in listings in the administration sections.

You can hide the title from display by theming your nodes to remove the title. Copy 'node.tpl.php' in your theme and rename it to 'node-webform.tpl.php', then remove the $title variable.

Andric Villanueva’s picture

Never mind. I out-did myself with this one.

quicksketch’s picture

Status: Active » Closed (fixed)
wolfmarter’s picture

Status: Closed (fixed) » Active

Hey i reopened this tag because i have tried to remove the title of my webform but it did not work.

I copied the node.tpl.php in my theme folder and renamed it. Then i removed the Tag:

<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

but nothing happened. I also tried to give the title a name instead of the $title variable but nothing. Do i have to declare the node-webform.tpl.php somewhere in the theme?

Thanks for some help

Wolfmarter

quicksketch’s picture

You need to have both node.tpl.php and node-webform.tpl.php in your theme directory for this to work. Also make sure you clear your Drupal caches after copying the files in.

wolfmarter’s picture

Status: Active » Closed (fixed)

Thank you for ypour help it worked. This is an awesome Module.

Regards

Wolfmarter

truyenle’s picture

For my case, if I remove $content=> there'll be no content but if I remove the $title, it is still there somehow??? Clear cache didn't help.

wolfmarter’s picture

you must have missed a $title tag somewhere. post your code an then we will be able to help you.

regards

wolfmarter

truyenle’s picture

Here is the code of node-webform.tpl.php wolfmarter,

<?php
div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?>"><div class="node-inner">

  <?php print $picture; ?>

  <?php if (!$page): ?>
    <h2 class="title">
      
    </h2>
  <?php endif; ?>

  <?php if ($unpublished): ?>
    <div class="unpublished"><?php print t('Unpublished'); ?></div>
  <?php endif; ?>

  <?php if ($submitted || $terms): ?>
    <div class="meta">
      <?php if ($submitted): ?>
        <div class="submitted">
          <?php print $submitted; ?>
        </div>
      <?php endif; ?>

      <?php if ($terms): ?>
        <div class="terms terms-inline"><?php print t(' in ') . $terms; ?></div>
      <?php endif; ?>
    </div>
  <?php endif; ?>

  <div class="content">
    <?php //print $content; ?>
  </div>

  <?php print $links; ?>

</div></div> <!-- /node-inner, /node -->
?>

If I view the webform node => still the title. I did clear cache, visite modules pages, etc. Doesn't work.

But then I found a post somewhere saying that I should use preprocess under template.tpl.php, it works. Here is the code:

<?php
function tsi_preprocess_page(&$vars) {
  // Titles are ignored by content type called webform
  $vars['original_title'] = $vars['title'];
  if (!empty($vars['node']) && in_array($vars['node']->type, array('webform'))) {
    $vars['title'] = '';
  }
}
?>
Hunabku’s picture

Thanks, i spent a lot of time trying to get templates to work and then i found your post.

If you want to change the name for individual forms use the nid of your webform - ex 1000
You don't need to test if empty &vars and type is webform, just go with:

if ($vars['node']->nid == 1000) {
  $vars['title'] = 'My new title';
}
F Kay’s picture

Component: Miscellaneous » Code
Assigned: Unassigned » F Kay
Status: Closed (fixed) » Active

Hi Hunabku

In what file dit you put this code?
And will it also work in Drupal 7?

Does this title will also appear in the tabheader of the webbrowser?
Because that is the problem that i'm having right now.
I have two different webforms and they have both a different title but the title is not visible in the tab-header of the page.
Can you help me whit this?

Regards

quicksketch’s picture

Assigned: F Kay » Unassigned
Status: Active » Closed (fixed)

Most of the solutions in this issue will work in D7 but the file names have changed. Instead of "node-webform.tpl.php", in D7 it's "node--webform.tpl.php". Unfortunately none of the posted comments here have anything to do with the page title in the HEAD tag. @F Kay, if you're still having this problem, please open a separate issue describing your question.