Prettynice.FormData

Normal <form> elements with action="post" will have the data available at Request.formData.

It is a FormData value which is a mapping of field names to arrays of values.

You can use get to get a Maybe String of the first value associated with a field name, or getAll to get an Array String of all values associated with the field name.

See examples/forms for the full working example.

Querying form data

type alias FormData = Dict String (Array String)

Mapping of form field names to their values.

get : String -> FormData -> Maybe String

Get a Maybe String for the first value associated with a form field name.

getAll : String -> FormData -> Array String

Get an array of all the values associated with a form field name.

Parsing form data

Normally you should only need the query functions in your programs, but if you have a string of urlencoded formdata, you can turn it into a FormData value with fromString.

fromString : String -> FormData

Turn a string of urlencoded form data into a FormData value.