Does the button have type="button" on it, when you don’t set the type of a button and it is inside a forn it will be handled as a submit button.
The getElementById and dmxExtraData can’t trigger the form. The toBlob method is asynchronous, the callback will probably be called after your submit and the file data you added will not be included in the submit. You should return a promise and resolve that when the blob is created, the flow action runJS will wait until the promise is resolved before the next action is executed.
I can’t tell with the current code you’ve given what is causing the recursion of the submit, you could add a console.log to your canvastoimg function to see if that is also called multiple times, then you know if the whole flow is also called each time.
I just found that it occurs within Wappler. As soon as I saved the file (without opening in the browser and without it being open anywhere) it starts firing.
So it is a mystery what is triggering the form.
Are there other ways to see what is going on “behind the scenes” ? i.e. what wappler is sending (only uploading on save I assume?)
ps. also the design view gets greyed out after some time. I recall reading somewhere the design view triggers things?
To see what the form submits you have to open it in the browser and then you can inspect the data being submitted in devtools.
The design view probably stops responding after a while due to the many commits and that is causing it to grey out.
Saving the file should not trigger anything on the page, try commenting out the flow component and button and check if it then still submits the form. Commenting in html can be done by placing <!-- and --> around the tags.
As soon as I add something within the form part of the code and save it, it starts submitting form.
When I comment out the flow it doesn’t occur (which I tried already earlier).
The issue is, that it seems not to get triggered when using the page in the browser.
It only seems to occur when I work on the page within Wappler… and there is no console in Wappler to trace what is happening… or is there?
ps. also this is also happening (as mentioned elsewhere too) - not sure if it’s related (CPU 149%):
Perhaps you could send me that specific page in a private message, then I can try to reproduce the problem. Also send me the Wappler log file, it could perhaps contain some useful information.
Is there a way to see what is going on under the hood, ie. what Wappler is sending out to the server? A type of console or detailed log that shows all commands sent to the server?
Why do you have the submit in a flow? Why not just set the button to submit?
I think the way you have it now will not work. You are running the form action twice. Once on submitting the form and once in the flow. Take the action out of the form tag and put it in your flow if you want to use a flow.
Sorry if I don’t understand what it is you are trying to do.
Thanks for your comments Brad. I stripped the page to the bare minimum to narrow down the issue. I am aware this seems illogical in this simplified page, but I have reasons to do it this way =)
I do not think the form is submitted twice in this set up. The button is outside of the form so it should not trigger the form only the flow… Unless I missed something?
How and where are you typing something the div? I see in your code where you have a div. SHouldn’t that be a form field? How are you typing in that div?