Create Page is done
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user