Replies: 7 comments
-
Hi @henrycs, could you describe in which cases you have to handle the "useless" event? |
Beta Was this translation helpful? Give feedback.
-
This occurs in any case where there are trigger components with set values in a page. It's quite unintuitive to trigger the event when there is no change in value (and quite annoying to handle as well). |
Beta Was this translation helpful? Give feedback.
-
In @henrycs 's example, the button is clicked, but the app runs the textbox trigger. Many apps face similar situations. Extra (redundant) code is required to prevent the textbox trigger (but to run it when textbox is actually edited). |
Beta Was this translation helpful? Give feedback.
-
jsut like vopani said, if we set the initial value of a textbox, after page loaded, we have to process this first useless event. in my real case, I want to set textbox in other events and show the new value in the page, but current version of wave cannot do this, so I look for the second way, set new value to textbox using q.client.xxx or q.user.xxx, then reload the page, this time I get the expected result, but I have to handle this useless event, I don't know: the value is set by me or edited by user? |
Beta Was this translation helpful? Give feedback.
-
This is not a bug. The semantics are not "submit only when values change". By design, all values are sent from the UI to the app.
See docs. |
Beta Was this translation helpful? Give feedback.
-
I thought the same but there is some gap. It might not be a bug but it is difficult to handle easily because of how it's being submitted. Take the example above itself. After launching the app, when the button is clicked, the set textbox value is submitted even though not edited. Let's say this is fine (because some value is found).
It is currently being submitted |
Beta Was this translation helpful? Give feedback.
-
Hey @vopani @henrycs. I understand your confusion, let me clarify. TLDR#2113 solves your problem (or using The long story on why the current behavior makes senseThe reason why the value is submitted when set initially is because that's how forms work on the web in general. Imagine we have a form with 2 textboxes and one button. The first textbox is prefilled, the second is not. The user is expected to fill the second textbox, alter the first one if needed and hit the submit button. Wave submits the "whole" form in this case so that you can process all the data filled. The reason it's confusing when using
Not really. In our example, the form has already been submitted once so Wave assumes it had been processed already and there is no need to submit it again. Also "found" is meant like found in |
Beta Was this translation helpful? Give feedback.
-
Wave SDK Version, OS
wave 0.22.0, Ubuntu 20.4
Actual behavior
I put a textbox (with value, not empty) in my page, after page initialized, if there is any event triggered, the value of textbox will be added in this event (q.args). since the value of textbox is set by me, so I don't think it's a good idea to trigger this event (no value changes), in some cases, I have to handle this "useless" event.
Expected behavior
no event will be triggered if no value changes of input elements (such as textbox, choice_group, etc.)
Steps To Reproduce
after page initialized, click the button (ButtonA) to trigger an event.
my demo code:
Beta Was this translation helpful? Give feedback.
All reactions