aboutsummaryrefslogtreecommitdiff
path: root/src/client/Dialog/AddCategory/Model.elm
diff options
context:
space:
mode:
authorJoris2017-03-26 23:16:28 +0200
committerJoris2017-03-27 00:17:41 +0200
commit902acfbdbcc1d59941399753e887479e586e2748 (patch)
tree0ad90ead3f8bdf0ea7c94462d1577c8e188df469 /src/client/Dialog/AddCategory/Model.elm
parent8062f1c9c34e9b25d76b22bd6ba2a1a99666279b (diff)
downloadbudget-902acfbdbcc1d59941399753e887479e586e2748.tar.gz
budget-902acfbdbcc1d59941399753e887479e586e2748.tar.bz2
budget-902acfbdbcc1d59941399753e887479e586e2748.zip
Improve form validation
- Trim names - Income amount accepted from 0 - Validate colors
Diffstat (limited to 'src/client/Dialog/AddCategory/Model.elm')
-rw-r--r--src/client/Dialog/AddCategory/Model.elm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/Dialog/AddCategory/Model.elm b/src/client/Dialog/AddCategory/Model.elm
index 7496c2b..3b70482 100644
--- a/src/client/Dialog/AddCategory/Model.elm
+++ b/src/client/Dialog/AddCategory/Model.elm
@@ -8,14 +8,16 @@ module Dialog.AddCategory.Model exposing
)
import Date exposing (Date)
-import View.Date as Date
+import Dict
import Form exposing (Form)
import Form.Field as Field exposing (Field)
import Form.Validate as Validate exposing (Validation)
+import Model.Category exposing (Categories, Category, CategoryId)
import Model.Translations exposing (Translations)
-import Model.Category exposing (Category, CategoryId)
+import Validation
+import View.Date as Date
type alias Model =
{ id : Maybe CategoryId
@@ -49,4 +51,4 @@ validation =
Validate.map3 Model
(Validate.field "id" (Validate.maybe Validate.int))
(Validate.field "name" (Validate.string |> Validate.andThen Validate.nonEmpty))
- (Validate.field "color" (Validate.string |> Validate.andThen Validate.nonEmpty))
+ (Validate.field "color" Validation.color)