Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
I am in need to theme webform in D7.
How can I do that ?
In the search I've come to know that by using web-form-nid.tpl.php we are able to theme a drupal individual form.
Could any one guide me in this case to theme a webform.
You can theme a individual webform using webform-form-nid.tpl.php.
For example if our webform node id is 7 , create a template file namely webform-form-7.tpl.php and place it in your theme folder. Clear site cache.
Do a print_r($form); to see all the elements. Then render each elements in file within your html elements.
<?php print drupal_render($form['submitted']['name']); ?>
As @Patrick Kenny said read the theming.txt, it explain all aspects of theming a webform
I can't figure out how to render the submit button, please can you help
Can you specify what have been you tried so far and where you struck at? The submit button can render by something like this <?php print render(drupal_render($form['submit'])); ?> Do a print_r($form); for better understanding.
Or, alternatively, to render submit, you can just do: <?php print drupal_render_children($form); ?>. It will render everything else that you haven't specifically rendered, which for my form I'm working on now is just the submit button.
If you know the .tpl.php filename, here is what you do:
<pre><?php print_r(get_defined_vars()); ?></pre>