Attribute Macro metamorphose::Form [−][src]
#[Form]
Expand description
Macro for converting Structure to mango-orm Form. The form does not have access to the database. Form are needed where it makes no sense to use a model - To create a search form, to recover a password, to combine models, etc.
Example:
use mango_orm::*; use metamorphose::Form; use serde::{Deserialize, Serialize}; #[Form] #[derive(Serialize, Deserialize, Default, Debug)] pub struct RestorePassword { #[serde(default)] #[field_attrs( widget = "inputEmail", value = "Your Email", required = true, unique = true, maxlength = 74 )] pub email: Option<String>, // #[serde(default)] #[field_attrs( widget = "inputPassword", value = "Your old password", required = true, minlength = 8 )] pub old_password: Option<String>, // #[serde(default)] #[field_attrs( widget = "inputPassword", value = "Your new password", required = true, minlength = 8 )] pub new_password: Option<String>, // #[serde(default)] #[field_attrs( widget = "inputPassword", value = "Confirm the password", required = true, minlength = 8 )] pub confirm_password: Option<String>, }