Thursday, 07.24.2008, 04:16am (GMT)
  Home
  FAQ
  RSS
  Links
  Site Map
  Contact
 
Gmail Problem? Blank page? ; World of Warcraft Bots - Welcome To The Darkside ; Turkey Travel Guide ; All DSL Modem Passwords ; Video Game Tester Job Wanted
::| Keyword:       [Advance Search]
 
NAVIGATION  
  Travel
  Accounting
  Acne
  Aquarium Articles
  Computers-Technology
  Media
  Pets And Animals
  Cars and Trucks
  Fitness
  Internet
 » Seo
 » Google School
  Health
  Sport
  Politics
  Download
  Pictures

  ::| Submit Articles
Your Name:
Your Email:
 
 
 
Internet » Google School
 
Customize Google Docs Forms
Thursday, 05.08.2008, 01:12pm (GMT)

Adding forms as a way to include information in a Google Spreadsheet was one of the best decisions made by Google lately as it increased the adoption of the product. Unfortunately, Google doesn't offer options to customize the forms or validate the input. But just because Google hosts the forms for you doesn't mean you can't copy the code on your web pages and edit it.

After copying the code, you can edit the CSS rules to customize the form, remove the references to external files or the links to Google's terms of use. This article has a list of pretty forms customized only using CSS. If some of the fields need to have a certain format (for example: dates, email addresses etc.), you may include some JavaScript code that validates the input before submitting the form or after a certain field loses the focus. This JavaScript library includes the code for some common validations, so you can use it without too much programming effort. LiveValidation requires to write some code, but it validates the input as you type.

Here's a simple styled form that validates the first field using an annoying alert (you can submit the form only if JavaScript is enabled):

In what year did you first use Google?
What search engines did you use before Google?

 <style type="text/css" media="screen">.ss-form-container{width: 380px;background-color: #FFF;border: 1px solid #CCC;padding: 0.5em 1em;font-size: 0.9em;}.ss-q-title{font-weight: bold;padding-left:7px;display: block;}.ss-q-submit{color: #000;}.ss-form-entry{margin-bottom: 1.5em;} .ss-q-short, .ss-q-submit{background:#f7f7f7;border:solid gray 1px;margin:8px;padding:0px 3px; color:#666666; }</style><script type="text/javascript">function custommsg() {document.getElementById("form-message").style.display=""; document.getElementById("form-message").innerHTML="Thanks for your answers!"; document.getElementById("form-container").style.display="none";} function validate(f){var year =parseInt(f.elements[0].value);if (isNaN(year)|| year<1996 || year > (new Date()).getFullYear()){alert("Invalid year");return false; } return true;}</script> <div class="ss-form-container" style="display:none;" id="form-message"> </div> <div class="ss-form-container" id="form-container"><form action="" method="POST" target="fake-target" onsubmit="this.action='http://spreadsheets.google.com/formResponse?key=pLaE9tsVLp_1lGkqPo-vdfw'; if (validate(this)) {custommsg(); return true;} else return false;"><div class="ss-form-entry"><span class="ss-q-title">In what year did you first use Google?</span><input type="text" class="ss-q-short" name="single:0" /></div><div class="ss-form-entry"><span class="ss-q-title">What search engines did you use before Google?</span><input type="text" class="ss-q-short" name="single:1" /></div><p></p><input type="submit" class="ss-q-submit" value="Submit" /></form></div><iframe src="#" id="fake-target" name="fake-target" style="width:0px; height:0px; border:0px;"></iframe><br />

Validation only works when JavaScript is enabled in your browser. Note that if you edit the form using Google Docs, you need to change the code from your web page.

    Print        Tell friend        Top


Other Articles:
A Conversation About Google, Microsoft and Yahoo (05.08.2008)
Monitor Google's Homepage with Page2RSS (05.08.2008)
Google OneBox for Premier League (and Other Sports Results) (05.08.2008)
Share and Annotate Web Pages in Google Reader (05.08.2008)
Google Maps Facelift (05.08.2008)
Display Google Talk Presence (05.08.2008)
Increase Font Size in Google Reader (05.08.2008)
Explore Places in Google Maps (05.08.2008)
Google Translate Becomes the Best Free Online Translator - New (05.08.2008)
Gmail Problem? Blank page? (05.08.2008)



 
  ::| Events
July 2008  
Su Mo Tu We Th Fr Sa
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
 
::| Hot News
Gmail Problem? Blank page?
Google Pagerank from A to Z

Other Articles: languageleases leasing - structured settlements - video conferencing - video streaming


[Top Page]