diff --git a/examples/pokedex/app/Route/TailwindForm.elm b/examples/pokedex/app/Route/TailwindForm.elm index e5a8ef72..0cbf53ce 100644 --- a/examples/pokedex/app/Route/TailwindForm.elm +++ b/examples/pokedex/app/Route/TailwindForm.elm @@ -8,7 +8,7 @@ import Date exposing (Date) import Dict exposing (Dict) import Effect exposing (Effect) import ErrorPage exposing (ErrorPage) -import Form exposing (Form) +import Form import Form.Field as Field import Form.FieldView import Form.Validation as Validation exposing (Validation) diff --git a/examples/smoothies/app/Route/Profile/Edit.elm b/examples/smoothies/app/Route/Profile/Edit.elm index 2f46cfe6..21675fa6 100644 --- a/examples/smoothies/app/Route/Profile/Edit.elm +++ b/examples/smoothies/app/Route/Profile/Edit.elm @@ -132,7 +132,7 @@ formParser = let errors field = info.errors - |> Form.errorsForField field + |> Form.errorsForField2 field errorsView field = (-- TODO diff --git a/src/Form.elm b/src/Form.elm index a81e3f0f..67ceacc7 100644 --- a/src/Form.elm +++ b/src/Form.elm @@ -1,13 +1,11 @@ module Form exposing - ( Form(..), FieldErrors, HtmlForm, StyledHtmlForm - , ParsedField + ( Form(..), FieldErrors , andThen - , Context, ViewField + , Context , renderHtml, renderStyledHtml , FinalForm, withGetMethod - , Errors, errorsForField + , Errors , parse, runOneOfServerSide, runServerSide - , HtmlSubForm , runOneOfServerSideWithServerValidations , AppContext , FieldDefinition(..) @@ -359,16 +357,6 @@ field2 name (Field fieldParser kind) (FormNew definitions parseFn toInitialValue parsedField = Pages.Internal.Form.Validation (Just thing) (Just name) ( maybeParsed, Dict.empty ) - rawField : ViewField error parsed kind - rawField = - { name = name - , value = rawFieldValue - , status = fieldStatus - , kind = ( kind, fieldParser.properties ) - , parsed = maybeParsed - , errors = errors - } - myFn : { result : Dict String (List error) , parsedAndView : Validation error parsed kind -> parsedAndView @@ -574,14 +562,6 @@ type Errors error = Errors (Dict String (List error)) -{-| -} -errorsForField : ViewField error parsed kind -> Errors error -> List error -errorsForField viewField (Errors errorsDict) = - errorsDict - |> Dict.get viewField.name - |> Maybe.withDefault [] - - {-| -} errorsForField2 : Validation error parsed kind -> Errors error -> List error errorsForField2 field_ (Errors errorsDict) = @@ -1538,15 +1518,6 @@ toResult ( maybeParsed, fieldErrors ) = Err fieldErrors -{-| -} -type alias HtmlForm error parsed data msg = - Form - error - (Validation error parsed Never) - data - (Context error data -> List (Html (Pages.Msg.Msg msg))) - - {-| -} type alias HtmlFormNew error parsed data msg = FormNew @@ -1557,24 +1528,6 @@ type alias HtmlFormNew error parsed data msg = data -{-| -} -type alias HtmlSubForm error parsed data msg = - Form - error - (Validation error parsed Never) - data - (Context error data -> List (Html (Pages.Msg.Msg msg))) - - -{-| -} -type alias StyledHtmlForm error parsed data msg = - Form - error - (Validation error parsed Never) - data - (Context error data -> List (Html.Styled.Html (Pages.Msg.Msg msg))) - - {-| -} type alias StyledHtmlFormNew error parsed data msg = FormNew @@ -1654,22 +1607,6 @@ type FieldDefinition | HiddenField -{-| -} -type alias ParsedField error parsed = - Validation error parsed Named - - -{-| -} -type alias ViewField error parsed kind = - { name : String - , value : Maybe String - , status : Form.FieldStatus - , kind : ( kind, List ( String, Encode.Value ) ) - , parsed : Maybe parsed - , errors : List error - } - - {-| -} addErrorsInternal : String -> List error -> Dict String (List error) -> Dict String (List error) addErrorsInternal name newErrors allErrors =