Add query param autofill to form
This commit is contained in:
parent
1156cabe05
commit
1fcbac610f
@ -16,10 +16,15 @@ type Users struct {
|
||||
}
|
||||
|
||||
func (u Users) New(w http.ResponseWriter, r *http.Request) {
|
||||
u.Templates.New.Execute(w, nil)
|
||||
var data struct {
|
||||
Email string
|
||||
}
|
||||
data.Email = r.FormValue("email")
|
||||
u.Templates.New.Execute(w, data)
|
||||
}
|
||||
func (u Users) Create(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, "TODO! ", r.FormValue("email"))
|
||||
|
||||
}
|
||||
|
||||
func FromStaticTemplate(templatePath ...string) Users {
|
||||
|
||||
@ -14,12 +14,21 @@
|
||||
<label for="signupEmail" class="text-sm font-semibold text-gray-800">Email Address</label>
|
||||
<input name="email" id="signupEmail" type="email" placeholder="Email address" required autocomplete="email"
|
||||
class="w-full px-3 py-2 boarder boarder-gray-300 placeholder-gray-500 text-gray-800 rounded"
|
||||
value="{{.Email}}"
|
||||
{{if not .Email}}autofocus{{end}}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="signupPassword" class="text-sm font-semibold text-gray-800">Password</label>
|
||||
<input name="password" id="signupPassword" type="password" placeholder="password" required
|
||||
class="w-full px-3 py-2 boarder boarder-gray-300 placeholder-gray-500 text-gray-800 rounded"
|
||||
{{if .Email}}autofocus{{end}}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="referalCode" class="text-sm font-semibold text-gray-800">Referal Code</label>
|
||||
<input name="referalCode" id="referalCode" type="text" placeholder="Referal Code" required
|
||||
class="w-full px-3 py-2 boarder boarder-gray-300 placeholder-gray-500 text-gray-800 rounded"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user