UIForm

open class UIForm

A wrapper class for an HTML form.

  • The HTML form that is the base of the class

    Declaration

    Swift

    public let form = UIElement(element: .form)
  • Creates a form with a label and input for each item.

    Declaration

    Swift

    public init(with items: [String], idPrefix: String? = nil, submitText: String, and action: String? = nil)

    Parameters

    items

    The items that will be used for each label/input combonation for the form.

    idPrefix

    The prefix for the id’s for the wrappr divs, inputs and labels. This defaults for nil.

    submitText

    The text for the submission button.

    action

    The path that the data will be sent to at form submission.

  • Creates a form for loging in a user.

    Declaration

    Swift

    public class func loginForm(with login: LoginFormType, and action: String) -> UIForm

    Parameters

    login

    The login that will be used to authenticate the user. This could be an email or username.

    action

    The path that the data will be sent to at form submission.

    Return Value

    A UIForm for authenticating a user.

  • Creates a basic form for signing up a user.

    Declaration

    Swift

    public class func signUpForm(with action: String, and idPrefix: String = "user") -> UIForm

    Parameters

    action

    The path that the data will be sent to at form submission.

    idPrefix

    The prefix for the element’s ids. This defaults to “user”.

    Return Value

    The UIForm that contains the HTML form that will be submited on submission.

  • The top level element of the class. In this case, it is the form property.

    Declaration

    Swift

    public var topElement: UIElement