pub struct FormField {
pub name: String,
pub label: String,
pub widget: String,
pub value: Value,
pub required: bool,
pub readonly: bool,
pub help_text: Option<String>,
pub placeholder: Option<String>,
pub choices: Option<Vec<(String, String)>>,
pub errors: Vec<String>,
pub attrs: HashMap<String, String>,
}Expand description
Form field for editing
Fields§
§name: StringField name
label: StringDisplay label
widget: StringWidget type
value: ValueCurrent value
required: boolIs required?
readonly: boolIs readonly?
help_text: Option<String>Help text
placeholder: Option<String>Placeholder
choices: Option<Vec<(String, String)>>Choices (for select)
errors: Vec<String>Validation errors
attrs: HashMap<String, String>HTML attributes
Implementations§
Source§impl FormField
impl FormField
Sourcepub fn from_definition(field: &FieldDefinition) -> Self
pub fn from_definition(field: &FieldDefinition) -> Self
Create from field definition
Sourcepub fn with_value(self, value: Value) -> Self
pub fn with_value(self, value: Value) -> Self
Set 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