form

package
v0.0.0-...-ebdf1d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 9 Imported by: 64

Documentation

Overview

Package form provides form validation, repopulation for controllers and a funcmap for the html/template package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTooLarge is when the uploaded file is too large
	ErrTooLarge = errors.New("File is too large.")
)

Functions

func Map

func Map() template.FuncMap

Map returns a template.FuncMap that contains functions to repopulate forms.

func Repopulate

func Repopulate(src url.Values, dst map[string]interface{}, list ...string)

Repopulate updates the dst map so the form fields can be refilled.

func Required

func Required(req *http.Request, required ...string) (bool, string)

Required returns true if all the required form values and files are passed.

Types

type Info

type Info struct {
	FileStorageFolder string `json:"FileStorageFolder"`
}

Info holds the details for the form handling.

func (Info) UploadFile

func (c Info) UploadFile(r *http.Request, name string, maxSize int64) (string, string, error)

UploadFile handles the file upload logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL