pub struct Wizard<C = Schema> { /* private fields */ }Expand description
A block walking a form’s fields one Step at a time, with a button to the next step and one
back.
use tablo_core::{Field, Schema, Step, Wizard};
let user = User::fields();
Schema::new(Wizard::new([
Step::new("Account").schema((Field::text(user.name()), Field::text(user.email()))),
Step::new("About").schema(Field::text(user.bio()).multiline(4)),
]));Every step’s fields render and post, as a Tabs block’s do, and the form’s
own buttons save from any step. The next step opens once the browser’s own checks pass on the
current one’s controls; a later step’s trigger runs them on each step before it, and an earlier
one’s opens it without. Enter in a field moves to the next step rather than saving, until the
last. The page opens on the first step holding a field error, else on the first step; the
browser opens the step of a control it refuses on submit. A step whose every field the request
may not see renders no trigger, and a block with no such step renders nothing.
Implementations§
Source§impl<F> Wizard<Schema<F>>
impl<F> Wizard<Schema<F>>
Sourcepub fn visible_when(
self,
watched: &impl Watched<F>,
values: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn visible_when( self, watched: &impl Watched<F>, values: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Shows the block and every field it holds only while watched posts one of
values, as TextField::visible_when shows a
field.