Fixed hiding of validation message in DataForm component.
This commit is contained in:
@@ -31,7 +31,7 @@ pub fn data_form<T: 'static + server_fn::ServerFn<()> + Clone + ForValidation>(
|
||||
}
|
||||
}
|
||||
action=action>
|
||||
<ModalDialog opener=opener title=title>
|
||||
<ModalDialog opener=opener title=title validator=validator>
|
||||
<ModalBody>
|
||||
<ServerErr result={upd_val} opener=opener/>
|
||||
<ValidationErr validator=validator />
|
||||
|
||||
@@ -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<Validator>,
|
||||
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();
|
||||
}/>
|
||||
</div>
|
||||
{children()}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user