add description input
This commit is contained in:
@@ -58,14 +58,15 @@ type BookField[T BookFieldType] struct {
|
||||
}
|
||||
|
||||
type BookForm struct {
|
||||
Name BookField[string]
|
||||
Editor BookField[string]
|
||||
Authors BookField[StrList]
|
||||
Year BookField[int]
|
||||
Keywords BookField[StrList]
|
||||
File BookField[BookFile]
|
||||
Error string
|
||||
Method string
|
||||
Name BookField[string]
|
||||
Description BookField[string]
|
||||
Editor BookField[string]
|
||||
Authors BookField[StrList]
|
||||
Year BookField[int]
|
||||
Keywords BookField[StrList]
|
||||
File BookField[BookFile]
|
||||
Error string
|
||||
Method string
|
||||
}
|
||||
|
||||
func NewBookForm() BookForm {
|
||||
@@ -73,6 +74,9 @@ func NewBookForm() BookForm {
|
||||
Name: BookField[string]{
|
||||
Name: "name",
|
||||
},
|
||||
Description: BookField[string]{
|
||||
Name: "description",
|
||||
},
|
||||
Editor: BookField[string]{
|
||||
Name: "editor",
|
||||
},
|
||||
@@ -122,6 +126,8 @@ func extractBookForm(r *http.Request) BookForm {
|
||||
}
|
||||
bf.Name.Value = name
|
||||
|
||||
bf.Description.Value = r.FormValue(bf.Description.Name)
|
||||
|
||||
editor := r.FormValue(bf.Editor.Name)
|
||||
if editor == "" {
|
||||
bf.Editor.Err = ErrInvalidEditor.Error()
|
||||
|
||||
Reference in New Issue
Block a user