From 8f435c011314da3ce68eb456f7296cbf0d548466 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Tue, 31 Oct 2023 09:16:13 +0000 Subject: [PATCH] Add comment --- IHP/View/Form.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IHP/View/Form.hs b/IHP/View/Form.hs index 63517a023..f4023693a 100644 --- a/IHP/View/Form.hs +++ b/IHP/View/Form.hs @@ -740,6 +740,9 @@ selectField field items = FormField SelectInput (map itemToTuple items) , fieldName = cs fieldName , fieldLabel = removeIdSuffix $ fieldNameToFieldLabel (cs fieldName) + -- If the field is not touched, we don't want to render the value from the model + -- so we force the user to select. If a value was explicitely set in the model, we + -- render that value. , fieldValue = if IHP.ModelSupport.didTouchField field model then inputValue (getField @fieldName model :: SelectValue item) else ""