diff --git a/src/Utils/Form.hs b/src/Utils/Form.hs index 1dfdc2703..79a3604b1 100644 --- a/src/Utils/Form.hs +++ b/src/Utils/Form.hs @@ -1667,7 +1667,8 @@ mpreq :: (RenderMessage site (ValueRequired site), HandlerSite m ~ site, MonadHa -- ^ Pseudo required -- -- `FieldView` has `fvRequired` set to `True` and @FormSuccess Nothing@ is cast to `FormFailure`. --- Otherwise acts exactly like `mopt`. +-- Otherwise acts exactly like `mopt` without a default value and like `mreq` with a given default value +mpreq f fs mx@(Just _) = mreq f fs mx -- This shortcut hides the invalid no-answer option if a default is provided mpreq f fs@FieldSettings{..} mx = do mr <- getMessageRender (res, fv') <- mpreq' f fs $ Just <$> mx