Learn Data Structures and Algorithms with Golang
上QQ阅读APP看书,第一时间看更新

The Update template

The Update template consists of the Header, Menu, and Footer templates, as follows. The form to update customer fields is found in the Update template. This form is submitted to a web path, /alter (Update.tmpl):

{{ define "Update" }}
{{ template "Header" }}
{{ template "Menu" }}
<br>
<h1>Update Customer</h1>
<br>
<br>
<form method="post" action="/alter">
<input type="hidden" name="id" value="{{ .CustomerId }}" />
Customer Name: <input type="text" name="customername" placeholder="customername" value="{{ .CustomerName }}" autofocus>
<br>
<br>
SSN: <input type="text" name="ssn" value="{{ .SSN }}" placeholder="ssn"/>
<br>
<br>
<input type="submit" value="Update Customer"/>
</form>
{{ template "Footer" }}
{{ end }}