Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu committed Oct 31, 2023
1 parent 0d923b3 commit 8f435c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions IHP/View/Form.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 8f435c0

Please sign in to comment.