pub struct FileField<F = ()>(/* private fields */);Expand description
A file field: Field::file, or a record form’s file control (F is the form).
Implementations§
Source§impl<F> FileField<F>
impl<F> FileField<F>
pub fn label(self, label: impl Into<String>) -> Self
pub fn name(&self) -> &str
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 field only while watched posts one of values: an option’s value, or
true for a checked toggle. A hidden field posts nothing, so an edit keeps its
stored value and a create takes its blank answer; a field with no blank answer
cannot be conditional.
let kind = Field::choice(Customer::fields().kind()).options(["person", "company"]);
let vat = Field::text(Customer::fields().vat_number()).visible_when(&kind, ["company"]);
Schema::new((kind, vat));Source§impl<F> FileField<F>
impl<F> FileField<F>
Sourcepub fn help(self, text: impl Into<String>) -> Self
pub fn help(self, text: impl Into<String>) -> Self
Renders text under the control, which the control names as its description.
Sourcepub fn disabled(self) -> Self
pub fn disabled(self) -> Self
Renders the control disabled on the create and edit forms. The server drops a
value posted for it anyway, so an edit keeps the stored value and a create takes
the field’s default, else its blank answer; a field with neither cannot be
created, and its panel refuses to mount.
Sourcepub fn disabled_on_edit(self) -> Self
pub fn disabled_on_edit(self) -> Self
Renders the control disabled on the edit form only: the create form sets the value, and no edit changes it.
Sourcepub fn custom(self, control: impl Control + 'static) -> CustomField<F>
pub fn custom(self, control: impl Control + 'static) -> CustomField<F>
Renders the field with an app’s Control instead, as Field::custom does:
how a record form’s control takes a custom input. The field keeps its key and
label; the replaced control’s own modifiers, such as email, unique or
options, are dropped with it.
Source§impl<F> FileField<F>
impl<F> FileField<F>
Sourcepub fn choice(self) -> ChoiceField<F>
pub fn choice(self) -> ChoiceField<F>
Renders the field as a choice instead, as Field::choice does, ready for
options or relationship.
The replaced control’s own modifiers are dropped with it.