all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp v2 4/4] wizard: fix form progressing when pressing enter
Date: Wed,  7 May 2025 11:11:12 +0200	[thread overview]
Message-ID: <20250507091112.1145019-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250507091112.1145019-1-d.csapak@proxmox.com>

commit
d5f3c95 (wizard: allow enter to be used for switching to next page)

intended the current page to be progressed with enter the same way
the next button is pressed.

The check for this was wrong though, since not only the form context
validity is relevant, also the page_lock state and previous page
validity state.

To fix this, use the WizardState's `can_progress` check we now have
instead, which is also used to enable/disable the `next` button.

Fixes: d5f3c95 (wizard: allow enter to be used for switching to next page)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
no changes in v2

 src/wizard.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wizard.rs b/src/wizard.rs
index 7990cf4..b01d641 100644
--- a/src/wizard.rs
+++ b/src/wizard.rs
@@ -523,9 +523,9 @@ impl Component for PwtWizard {
                 .class(Flex::Fill)
                 .form_context(form_ctx.clone())
                 .onsubmit(ctx.link().batch_callback({
-                    let form_ctx = form_ctx.clone();
+                    let state = self.controller.clone();
                     move |_| {
-                        if !form_ctx.read().is_valid() {
+                        if !state.read().can_progress() {
                             return None;
                         }
                         if let Some(page) = next_page.clone() {
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


  parent reply	other threads:[~2025-05-07  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07  9:11 [yew-devel] [PATCH yew-comp v2 1/4] wizard: move page valid/lock data into WizardState Dominik Csapak
2025-05-07  9:11 ` [yew-devel] [PATCH yew-comp v2 2/4] wizard: factor out 'can progress' logic check to WizardState Dominik Csapak
2025-05-07  9:11 ` [yew-devel] [PATCH yew-comp v2 3/4] wizard: optimize enabled check for next button Dominik Csapak
2025-05-07  9:11 ` Dominik Csapak [this message]
2025-05-08  9:16 ` [yew-devel] applied: [PATCH yew-comp v2 1/4] wizard: move page valid/lock data into WizardState Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250507091112.1145019-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal