bureaucromancy-0.1.0.2: Parse webforms & render to interactive hypertext
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.HTML.Form

Description

Parse webforms out of webpages

Synopsis

Documentation

data Form Source #

A collection of controls intended to be handle by a particular URL endpoint.

Constructors

Form 

Fields

  • action :: URI

    The URL which should receive valid input from this form.

  • enctype :: Text

    How to encode the data to be received by the URL.

  • method :: Text

    Which HTTP method to use.

  • validate :: Bool

    Whether to validate the form data before submitting it to the endpoint.

  • target :: Text

    Where to display the response.

  • acceptCharset :: [Text]

    Which character sets to encode the data in.

  • autocomplete :: Bool

    Whether to offer autocompletions for all controls.

  • formName :: Text

    The name of this form.

  • rel :: Text

    The purpose of this form, typically using an external vocabulary.

  • inputs :: [Input]

    What data should be sent to the endpoint.

  • lang :: String

    Which human language the form is written? To which additional messages should be localized?

data Input Source #

Individual piece of data to send to a webservice.

Constructors

Input 

Fields

  • label :: Text

    Human-legible yet brief description of this input.

  • description :: Node

    Human-legible longer-form description of this input.

  • inputType :: Text

    How this control should be presented to the user, supporting all the HTML5 input types. Support for more types may be added in the future, with any unsupported types fallingback to text entry.

  • dirname :: Text

    In which query parameter should we store the text direction?

  • inputName :: Text

    In which query parameter should we store this value?

  • value :: Text

    The user-provided value or caller-provided default to upload to the server.

  • inputAutocomplete :: Text

    Whether to autocomplete this input, if its enabled on the form.

  • autofocus :: Bool

    Whether this input has initial focus.

  • checked :: Bool

    Whether (for certain types) to upload the data for this input.

  • disabled :: Bool

    Whether to temporarily-disallow users from editting this value.

  • readonly :: Bool

    Whether to permanantly-disallow users from editting this value.

  • multiple :: Bool

    Whether to allow entering multiple values.

  • formAction :: Maybe URI

    If this control is used to submit the form, where to upload it.

  • formEnctype :: Maybe Text

    If this control is used to submit the form, which text encoding to use in the upload.

  • formMethod :: Maybe Text

    If this control is used to submit the form, which HTTP method to use.

  • formValidate :: Bool

    If this control is used to submit the form, whether to enforce validation.

  • formTarget :: Maybe Text

    If this control is used to submit the form, where to render the response.

  • inputMode :: Text

    Suggests which keyboard to use for the input.

  • list :: [OptionGroup]

    Autocompletion values provided by caller.

  • range :: (Maybe Text, Maybe Text)

    The minimum & maximum values for the value of this input.

  • step :: Maybe Text

    In which period from start do valid values occur?

  • lengthRange :: (Maybe Int, Maybe Int)

    The minimum & maximum lengths for the value of this input.

  • pattern :: Maybe Regex

    Optional regex to enforce on the value of this input.

  • required :: Bool

    Whether this control must have a value for it to be considered valid.

  • placeholder :: Text

    Sample value, often visual clarity of its role incurs inaccessibility. Make sure to communicate what's implied here elsewhere.

  • title :: Text

    Longform clarifications.

  • size :: Maybe Int

    How wide the control should be.

  • fileData :: FileSelector

    Additional data for inputs of type "file".

  • imageData :: ImageData

    Additional data for inputs of type "image".

  • textArea :: TextArea

    Additional data for inputs of type "textarea".

data OptionGroup Source #

A labelled-group of options, that can be collectively disabled.

Constructors

OptGroup 

Fields

data Option Source #

A possible value for an input.

Constructors

Option 

Fields

data FileSelector Source #

Data specific to "file" inputs.

Constructors

FileSelector 

Fields

  • fileAccept :: [Text]

    The MIMEtypes of the files which can be validly entered into this control.

  • fileCapture :: Text

    Whether options for capturing from a camera should be offered.

defaultFileData :: FileSelector Source #

Empty values for file data.

data ImageData Source #

Data specific to "image" inputs.

Constructors

ImageData 

Fields

defaultImageData :: ImageData Source #

Empty values for image data.

data TextArea Source #

Data specific to textarea inputs.

Constructors

TextArea 

Fields

defaultTextArea :: TextArea Source #

Empty values for textarea data.

parseElement :: Cursor -> Maybe Form Source #

Parse a form from the selected HTML element.

parseDocument :: Document -> Text -> Maybe Form Source #

Parse a named or numerically-indexed form from an HTML document.

ensureButtons :: Form -> Form Source #

Add submit & reset buttons to a form if they were missing!

Orphan instances

Eq Cursor Source # 
Instance details

Methods

(==) :: Cursor -> Cursor -> Bool #

(/=) :: Cursor -> Cursor -> Bool #