Create Page is done

This commit is contained in:
2017-10-07 16:37:14 +02:00
parent 98c813bff5
commit d15e4e967e
10 changed files with 227 additions and 14 deletions
+4 -1
View File
@@ -3,6 +3,7 @@ package formparser
import (
"errors"
"fmt"
"log"
"time"
)
@@ -24,12 +25,14 @@ func String(value string, target *string, min, max int) error {
func Select(value string, target *string, allowedValues []string, optional bool) error {
if value == "" {
if !optional {
return errors.New("not a valid option")
return errors.New("no option selected")
}
return nil
}
log.Println(value, allowedValues)
for _, allowedValue := range allowedValues {
if value == allowedValue {
*target = value