Expand description
Forms and form fields for handling user input.
This module provides a way to define forms and form fields for handling user input in a web application. It provides a way to create forms from requests, validate the form data, and render the form fields in an HTML form.
§Form derive macro
The easiest way to work with forms in Cot is to use the
Form derive macro. Just define a structure that will hold
all the form data you need, and derive the Form trait for it.
use cot::form::Form;
#[derive(Form)]
struct MyForm {
#[form(opts(max_length = 100))]
name: String,
}Modules§
- fields
- Built-in form fields that can be used in a form.
Structs§
- Form
Field Options - Generic options valid for all types of form fields.
- Form
Field Value - A value from a form field.
- Form
Field Value Error - An error that can occur when processing a form field value.
Enums§
- Form
Error - Error occurred while processing a form.
- Form
Error Target - An enum indicating the target of a form validation error.
- Form
Field Validation Error - An error that can occur when validating a form field.
- Form
Result - The result of validating a form.
Traits§
- AsForm
Field - A trait for types that can be used as form fields.
- DynForm
Field - A version of
FormFieldthat can be used in a dynamic context. - Form
- A trait for types that can be used as forms.
- Form
Context - A trait for form contexts.
- Form
Field - A form field.
Derive Macros§
- Form
- Derive the
Formtrait for a struct and create aFormContextfor it.