* [yew-devel] [PATCH yew-widget-toolkit] form: fix dirty check when validator normalizes field values
@ 2025-11-10 16:18 Hannes Laimer
2025-11-27 18:22 ` [yew-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2025-11-10 16:18 UTC (permalink / raw)
To: yew-devel
Having a default value for a field that was not be present in the initial
data led to the form being marked as dirty immediatly.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
src/widget/form/context.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/widget/form/context.rs b/src/widget/form/context.rs
index e0cad70..1398847 100644
--- a/src/widget/form/context.rs
+++ b/src/widget/form/context.rs
@@ -461,6 +461,11 @@ impl FormContextState {
if !radio_group {
field.apply_value(value);
+ // update default to match the validated result, so dirty checking works correctly
+ // when the validator normalizes the value
+ if let Ok(submit_value) = &field.result {
+ field.default = submit_value.clone();
+ }
}
let slab_key;
--
2.47.3
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [yew-devel] applied: [PATCH yew-widget-toolkit] form: fix dirty check when validator normalizes field values
2025-11-10 16:18 [yew-devel] [PATCH yew-widget-toolkit] form: fix dirty check when validator normalizes field values Hannes Laimer
@ 2025-11-27 18:22 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-11-27 18:22 UTC (permalink / raw)
To: yew-devel, Hannes Laimer
On Mon, 10 Nov 2025 17:18:30 +0100, Hannes Laimer wrote:
> Having a default value for a field that was not be present in the initial
> data led to the form being marked as dirty immediatly.
>
>
Applied, thanks!
[1/1] form: fix dirty check when validator normalizes field values
commit: dafd071998aa39f4231f4151446ecbc6fc8efc1a
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-27 18:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-10 16:18 [yew-devel] [PATCH yew-widget-toolkit] form: fix dirty check when validator normalizes field values Hannes Laimer
2025-11-27 18:22 ` [yew-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.