pub struct FormContext<'a> { /* private fields */ }Expand description
What a condition is given: the operation, the record, the signed-in user and the form’s current values.
Implementations§
Source§impl<'a> FormContext<'a>
impl<'a> FormContext<'a>
Sourcepub fn new(
operation: Operation,
record: Option<&'a Row>,
user: &'a ActingUser,
values: &'a FormInput,
) -> Self
pub fn new( operation: Operation, record: Option<&'a Row>, user: &'a ActingUser, values: &'a FormInput, ) -> Self
The context of a form for operation, editing record (none on create), for user,
whose fields hold values. The panel builds it; an app builds one to test a condition.
Sourcepub fn operation(&self) -> Operation
pub fn operation(&self) -> Operation
Whether the form creates a record or edits one, as Filament’s $operation.
Sourcepub fn record(&self) -> Option<&'a Row>
pub fn record(&self) -> Option<&'a Row>
The record being edited, as stored, as Filament’s $record: a runtime resource’s
Row, or a static resource’s record serialized to JSON. None on create.
Sourcepub fn user(&self) -> &'a ActingUser
pub fn user(&self) -> &'a ActingUser
The signed-in user, as auth()->user() in a Filament closure.
Sourcepub fn get(&self, name: &str) -> Option<&'a str>
pub fn get(&self, name: &str) -> Option<&'a str>
The current value of the field name, as Filament’s $get('name'): the value the
user has typed or chosen, or None when it is blank. When the form is first shown it
is the stored value. A field that is itself hidden gives its stored value, never one a
request sent for it. The value is not checked.
Sourcepub fn checked(&self, name: &str) -> bool
pub fn checked(&self, name: &str) -> bool
Whether the checkbox name is ticked. See FormInput::checkbox.
Trait Implementations§
Source§impl<'a> Clone for FormContext<'a>
impl<'a> Clone for FormContext<'a>
impl<'a> Copy for FormContext<'a>
Auto Trait Implementations§
impl<'a> Forget for FormContext<'a>
impl<'a> Freeze for FormContext<'a>
impl<'a> Move for FormContext<'a>
impl<'a> RefUnwindSafe for FormContext<'a>
impl<'a> Send for FormContext<'a>
impl<'a> Sync for FormContext<'a>
impl<'a> Unpin for FormContext<'a>
impl<'a> UnsafeUnpin for FormContext<'a>
impl<'a> UnwindSafe for FormContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more