Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Creating an Easy Print Button on Drupal Webforms

Parent Feed: 

Have you ever wanted to add a simple Javascript print button to a webform so that users could print out all of their entered data? I had a need to do this today for a coworker. I thought about working up a custom module, trying to build a custom template file for the form that contained the additional button, but instead decided to store it as simply a "markup" component/question.

Print button shown next to submit button

Basically you just add in the following code:

<div id="edit-actions" class="form-actions form-wrapper"><input id="edit-submit" class="form-submit" value="Print" name="print" onclick="window.print()" type="button" /></div>

This was tested on a D6 site, but the same idea should work perfectly on D7 sites. Enjoy!

Author: 
RSS Tags: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web