When I compile this code:
module Mpower where
import Html exposing (..)
import List exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (id, type', for, value, class)
customerList = ["Select Customer", "Customer 1","Customer 2","Customer 3"]
productList = ["Select Product", "Product 1", "Product 2", "Product 3"]
optionItem optionname =
option [ ] [ text optionname ]
selectItem labelname selectlabel listname =
{
label [ for labelname ] [ text selectlabel ],
select [ id labelname ] ( List.map optionItem listname )
}
view =
form [ id "quote-form" ]
[
h1 [] [ text "Sensational Quote Request Form" ],
selectItem "customer-select" "Customer: " customerList,
div [ class "quote-button" ] [ text "Request Quote!" ]
]
main = view
I receive the following error:
Detected errors in 1 module. [36m-- SYNTAX PROBLEM ------------------------------------------------- test-div.elm[0m
I ran into something unexpected when parsing your code!
19│ label [ for labelname ] [ text selectlabel ], [31m^[0m I am looking for one of the following things:
"|"
an equals sign '='
whitespace
What is causing this error and how do I resolve it?
The corrected selectItem is as follows:
selectItem labelname selectlabel listname =
div [ ]
[
label [ for labelname ] [ text selectlabel ],
select [ id labelname ] ( List.map optionItem listname )
]