diff --git a/src/components/data_form.rs b/src/components/data_form.rs index f3d1458..fe17e1f 100644 --- a/src/components/data_form.rs +++ b/src/components/data_form.rs @@ -31,7 +31,7 @@ pub fn data_form + Clone + ForValidation>( } } action=action> - + diff --git a/src/components/modal_box.rs b/src/components/modal_box.rs index 0ad0295..4ebdfb2 100644 --- a/src/components/modal_box.rs +++ b/src/components/modal_box.rs @@ -1,5 +1,6 @@ use crate::locales::trl; use leptos::*; +use crate::validator::Validator; #[derive(Copy, Clone)] pub struct DialogOpener { @@ -65,6 +66,8 @@ impl DialogOpener { pub fn ModalDialog( opener: DialogOpener, title: &'static str, + #[prop(optional)] + validator: Option, children: Children, ) -> impl IntoView { view! { @@ -80,7 +83,12 @@ pub fn ModalDialog( class="btn-close" data-bs-dismiss="modal" aria-label="Close" - on:click=move |_| opener.hide()/> + on:click=move |_| { + if let Some(v) = validator { + v.reset(); + } + opener.hide(); + }/> {children()}