Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

The argument to function beginnerProgram is causing a mismatch. #226

Open
Kennedy-s opened this issue Mar 16, 2017 · 3 comments
Open

The argument to function beginnerProgram is causing a mismatch. #226

Kennedy-s opened this issue Mar 16, 2017 · 3 comments

Comments

@Kennedy-s
Copy link

I am having a problem creating a login form and am getting along that mismatch problem and this are my codes am using

import Html.Attributes exposing (..)
import Html exposing (..)
import Http
import Svg exposing (..)

main =
Html.beginnerProgram
{ model = model
, view = view
, update = update
}

-- Model

type alias Model =
{ username : String
, password : String
, login : String
}

model : Model
model =
{ username = ""
, password = ""
, login = ""
}

-- Update

type Msg
= Username String
| Password String
| Login String

update msg model =
case msg of
login ->
( model, Cmd.none)

-- View
view : Model -> Html Msg
view model =
Html.form [ id "login-form" ]
[ Html.h1 [] [ Html.text "Sensational Login Form" ]
, Html.label [ for "username-filed" ] [ Html.text "username" ]
, input [ id "username-filed"
, type_ "text"
, value model.username
]
[]
, label [ for "passwortd-field"] [ Html.text "password: " ]
, input [ id "password-field"
, type_ "password"
, value model.password
]
[]
, div [ class "login-button" ] [ Html.text "Log In" ]
]

-- Subscriptions

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@devjason
Copy link

The type signature for update in Html.beginnerProgram is Msg -> Model -> Model, not Msg -> Model -> (Model, Cmd Msg). If you are wanting to use commands as part of your update you may want to try using Html.program.

@Kennedy-s
Copy link
Author

Thanks a lot Devjason it's working now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants