An unofficial blog that watches Google's attempts to move your operating system online since 2005. Not affiliated with Google.

Send your tips to gostips@gmail.com .

May 3, 2008

Customize Google Docs Forms

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?



And here's the code:


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.

{ Thanks, A. }

This blog is not affiliated with Google.