mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
deactivate send button on empty input
This commit is contained in:
parent
ce9695f2d0
commit
f3a2a31872
@ -52,11 +52,14 @@ impl Response {
|
|||||||
let control = control.clone();
|
let control = control.clone();
|
||||||
let form = form.clone();
|
let form = form.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
control.update(size_limit.map(|limit| {
|
control.update(
|
||||||
limit
|
form.widget.text().is_empty(),
|
||||||
- (base.to_string_partial(UriHideFlags::QUERY).len()
|
size_limit.map(|limit| {
|
||||||
+ Uri::escape_string(&form.widget.text(), None, false).len())
|
limit
|
||||||
}))
|
- (base.to_string_partial(UriHideFlags::QUERY).len()
|
||||||
|
+ Uri::escape_string(&form.widget.text(), None, false).len())
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ impl Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
||||||
// Update children components
|
// Update children components
|
||||||
self.counter.update(bytes_left);
|
self.counter.update(bytes_left);
|
||||||
self.send.update(match bytes_left {
|
self.send.update(match bytes_left {
|
||||||
Some(left) => left > 0,
|
Some(left) => !is_empty && left > 0,
|
||||||
None => false,
|
None => false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user