DefaultPostForm returns the specified key from a POST urlencoded form or multipart form when it exists, otherwise it returns the specified defaultValue string. See: PostForm() and GetPostForm() for further information.
(key, defaultValue string)
| 607 | // when it exists, otherwise it returns the specified defaultValue string. |
| 608 | // See: PostForm() and GetPostForm() for further information. |
| 609 | func (c *Context) DefaultPostForm(key, defaultValue string) string { |
| 610 | if value, ok := c.GetPostForm(key); ok { |
| 611 | return value |
| 612 | } |
| 613 | return defaultValue |
| 614 | } |
| 615 | |
| 616 | // GetPostForm is like PostForm(key). It returns the specified key from a POST urlencoded |
| 617 | // form or multipart form when it exists `(value, true)` (even when the value is an empty string), |