diff options
Diffstat (limited to 'formlets.rkt')
| -rw-r--r-- | formlets.rkt | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/formlets.rkt b/formlets.rkt index ce92129..9de9469 100644 --- a/formlets.rkt +++ b/formlets.rkt @@ -17,14 +17,14 @@ #:attributes '((class "form-control") [required "required"]))))) (define (nutrient-value-formlet nutrient) - (define id (nutrient-id nutrient)) + (define id (number->string (nutrient-id nutrient))) (define number-input (input #:type "number" - #:attributes `((class "form-control") [id ,(number->string id)] + #:attributes `((class "form-control") [id ,id] [step "0.1"] [placeholder ,(nutrient-french-name nutrient)]))) (define input-label - `(label ((for ,(number->string id) + `(label ((for ,id )) ,(nutrient-french-name nutrient))) (formlet (#%# (div ((class "form-floating mb-3")) ,{=> number-input nutrient-value-b} ,input-label)) @@ -45,7 +45,7 @@ (values measured-on nutrient-values)))) (define (crop-requirement-formlet requirement) - (define id (crop-requirement-id requirement)) + (define id (number->string (crop-requirement-id requirement))) (define profile (crop-requirement-profile requirement)) (define maybe-crop (crop-requirement-crop-id requirement)) (define crop @@ -53,14 +53,12 @@ (crop-name (get-crop #:id maybe-crop)) #f)) (define number-input - (input #:type "number" - #:attributes `((class "form-control") [id ,(number->string id)] - [min "0"] - [max "100"] - [step "1"] - [placeholder ,profile]))) + (input + #:type "number" + #:attributes + `((class "form-control") [id ,id] [min "0"] [max "100"] [step "1"] [placeholder ,profile]))) (define input-label - `(label ((for ,(number->string id) + `(label ((for ,id )) ,(if crop (format "~a (~a)" crop profile) |