Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Handling Forms

If we want users to be able to post their own greetings, we need a way to process information submitted by the user with a web form. The Go http package makes processing form data easy.

Handling Web Forms

Replace the contents of myapp/hello.go with the following:

Reload the page to see the form, then try submitting a message.

This version has two handlers: the path / is mapped to root , which displays a web form. The path /sign is mapped to sign , which displays the data submitted by the web form.

The sign function gets the form data by calling r.FormValue and passes it to signTemplate.Execute that writes the rendered template to the http.ResponseWriter . In the template code, the content is automatically filtered to escape HTML special characters. The automatic escaping is a property of the html/template package, as distinct from text/template .

Next…

Now that we can collect information from the user, we need a place to put it and a way to get it back.

Using the Datastore >>

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.