@gform
@gform allows you to easily create web forms where the data
is populated in a google spreadsheet. This is uber cool as
a way to get sign up lists, make polls or otherwise
interact via web forms.
Getting started is easy. There are four version depending
on how you want to handle the 'thank you for submitting
portion' and the text below can be used as a 'quick
reference'
| Command |
Action on submit |
| @gform((key:form_key)) |
uses google standard action |
| @gform((key:form_key,
thanks:thanks
message)) |
Displays the ‘thanks message’ as
typed |
| @gform((key:form_key,
thanksURL:URL to redirect after
submitting)) |
Redirects to the specified URL (URL should be of type
some.page.com without the preceding
http://) |
| @gform((key:form_key,
thanksPage:Page contents to show
after submitting)) |
Displays contents of RapidWeaver page (similar to
a @import) |
Finding the "Key"
The first argument 'key' comes from google when you
make a form. To get one create a new spreadsheet in google
docs (or open an existing one) and go to the 'share' tab
From there select 'to fill out a form'. Google docs
will ask you to start editing the form -- from here you can
create questions with, determine what type of answers are
allowable, etc. When you are complete Google docs will ask
you to 'choose recipients'
On that page they will give you the option of
emailing people -- don't do that, just note down the 'key'
in the form URL -- It's a long series of numbers and
letters (in this case pegfyTc.....)
Determining the Action
After you have the key you need to decide what action
should occur when the user hits 'submit' -- there are four
options outlined above ranging from the default 'google'
action, simple text string, redirect to a URL or display
the contents of another RapidWeaver page (think of this as
similar to a @import)
For instance to simply use the default google action you
would type
@gform((key:pegfyTc8f6LYH3togWa2AWQ))
If you wanted the form to be replaced with a message
"Thanks for submitting" you would say (good for simple
messages)
@gform((key:pegfyTc8f6LYH3togWa2AWQ,thanks:Thanks for
submitting))
If you wanted the to redirect the user to
http://loghound.com you would
use the form shown below -- (this is good if you have
an external page that you want them to go to)
@gform((key:pegfyTc8f6LYH3togWa2AWQ,thanksURL:loghound.com))
Finally, if you had a page that was title 'thank you
message' you would use (This option is good if your thank
you message is elaborate or includes graphics)
@gform((key:pegfyTc8f6LYH3togWa2AWQ,thanksPage:thank you
message))
Other notes:
You will want to add some custom CSS to get things to look
right, below is the suggested CSS that should allow you to
keep your overall theme look while making the form look a
bit cleaner.
.ss-q-title {
font-weight: bold;
display: block;
}
.ss-form-desc {
font: inherit;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
word-wrap: break-word;
width: 99%;
}
.ss-q-help {
color: #666;
}
.ss-form-entry {
margin-bottom: 1.5em;
}
.ss-choices {
list-style: none;
margin: 0.5em 0 0 0;
padding: 0;
}
Where does the form data go?
If you go back to your spreadsheet you will see that
magically new header text has been entered, as users submit
the form it gets added, one row at a time (for up to 5000
rows). Lots of interesting things can be done with this,
for instance you can go in and edit entries using the
spreadsheet tools. You can do analysis using spreadsheet
formulas or you can display the results on a page using
@gtable