pub struct FormState { /* private fields */ }Expand description
Implementations§
Source§impl FormState
impl FormState
Sourcepub fn fields(self: Handle<Self>, app: &App) -> Vec<DynamicFormFieldState>
pub fn fields(self: Handle<Self>, app: &App) -> Vec<DynamicFormFieldState>
The FormFieldState objects that are currently registered with this Form.
Sourcepub fn reset(self: Handle<Self>, app: &mut App)
pub fn reset(self: Handle<Self>, app: &mut App)
Resets every FormField that is a descendant of this Form back to its
FormFieldData::initial_value.
The Form::on_changed callback will be called.
If the form’s Form::autovalidate_mode property is AutovalidateMode::Always, the
fields will all be revalidated after being reset.
Sourcepub fn clear_error(self: Handle<Self>, app: &mut App)
pub fn clear_error(self: Handle<Self>, app: &mut App)
Clears the validation errors for all FormFields in this Form without resetting
their values.
See also:
FormFieldStateLeaf::clear_error, which clears the error for a single form field.
Sourcepub fn validate(self: Handle<Self>, app: &mut App) -> bool
pub fn validate(self: Handle<Self>, app: &mut App) -> bool
Validates every FormField that is a descendant of this Form, and returns true if
there are no errors.
The form will rebuild to report the results.
See also:
validate_granularly, which also validates descendantFormFields, but instead returns a set of fields with errors.
Sourcepub fn validate_granularly(
self: Handle<Self>,
app: &mut App,
) -> IndexSet<DynamicFormFieldState>
pub fn validate_granularly( self: Handle<Self>, app: &mut App, ) -> IndexSet<DynamicFormFieldState>
Validates every FormField that is a descendant of this Form, and returns a set
of DynamicFormFieldState of the invalid field(s) only, if any.
This method can be useful to highlight field(s) with errors.
The form will rebuild to report the results.
See also:
Trait Implementations§
Source§impl State for FormState
impl State for FormState
Source§fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>
fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>
state
(state_accessors!).Source§fn state_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut StateData<Self::Widget>
fn state_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut StateData<Self::Widget>
state_data.Source§fn build(self: Handle<Self>, app: &mut App, _context: BuildContext) -> WidgetRef
fn build(self: Handle<Self>, app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn widget(self: Handle<Self>, app: &App) -> &Self::Widget
fn widget(self: Handle<Self>, app: &App) -> &Self::Widget
Source§fn context(self: Handle<Self>, app: &App) -> BuildContext
fn context(self: Handle<Self>, app: &App) -> BuildContext
Source§fn init_state(self: Handle<Self>, app: &mut App)
fn init_state(self: Handle<Self>, app: &mut App)
Source§fn did_update_widget(
self: Handle<Self>,
app: &mut App,
old_widget: &Self::Widget,
)
fn did_update_widget( self: Handle<Self>, app: &mut App, old_widget: &Self::Widget, )
Source§fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))
fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))
Source§fn deactivate(self: Handle<Self>, app: &mut App)
fn deactivate(self: Handle<Self>, app: &mut App)
Source§fn activate(self: Handle<Self>, app: &mut App)
fn activate(self: Handle<Self>, app: &mut App)
deactivate. Read moreSource§fn dispose(self: Handle<Self>, app: &mut App)
fn dispose(self: Handle<Self>, app: &mut App)
Source§fn did_change_dependencies(self: Handle<Self>, app: &mut App)
fn did_change_dependencies(self: Handle<Self>, app: &mut App)
Source§fn debug_fill_properties(
self: Handle<Self>,
app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties this state shows where its element’s dump
names it (state: ScrollableState#1a2b3(offset: 0.0)), after the lifecycle and mounting
properties State’s base adds, which the framework adds first.