pub struct FormField {
pub name: String,
pub field_type: String,
pub label: String,
pub required: bool,
pub value: Option<String>,
pub placeholder: Option<String>,
pub selector: Option<String>,
pub options: Vec<String>,
}Expand description
A field in a form.
Fields§
§name: StringField name attribute.
field_type: StringField type (text, email, password, etc.).
label: StringField label text.
required: boolWhether the field is required.
value: Option<String>Current value.
placeholder: Option<String>Placeholder text.
selector: Option<String>CSS selector.
options: Vec<String>Options for select fields.
Implementations§
Source§impl FormField
impl FormField
Sourcepub fn new(name: impl Into<String>, field_type: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, field_type: impl Into<String>) -> Self
Create a new form field.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set label.
Sourcepub fn with_selector(self, selector: impl Into<String>) -> Self
pub fn with_selector(self, selector: impl Into<String>) -> Self
Set selector.
Sourcepub fn with_value(self, value: impl Into<String>) -> Self
pub fn with_value(self, value: impl Into<String>) -> Self
Set current value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FormField
impl<'de> Deserialize<'de> for FormField
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FormField
impl RefUnwindSafe for FormField
impl Send for FormField
impl Sync for FormField
impl Unpin for FormField
impl UnwindSafe for FormField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more