Hi I am hoping to get some help with an issue I have when trying to submit a form on page load.
So I have a form with hidden elements, that are just capturing some users data. what i want to do is to submit the form when the page first loads. I have tried adding the dynamic event to App connect properties (note image below is using the ready event, but I have also tried the onload). however I can get the form to subset. I know I am missing something, but I am not sure what, would appreciate any help
I am a little confused by the question to be honest.
So your page loads and a bunch of hidden data is entered into hidden form inputs on your page and on submit that runs a server action to save the values of the inputs into a database or some external data store?
If that is the case, then the way I see it you do not need a form at all, you can just have the server connect run on page load and pull all the values direct without going through the form.
Ok, let me see if I can do a better job trying to explain.
So I have db table called notifications, one of the fields is the status and it can be 1 for (has not been seen) and 0 for (it has been seen).
What I wanted to do to change the status from 1 to 0 was to have a hidden form with the 0 value and as soon as the page loads ti will submit to update the status value to 0.
Now keep in mind that is the logic I came out with, I don’t know if this is the right way to do it. The challenge I have is that I cannot get the form to be submitted on page load.
Ahh I see, makes sense, kind on like a cookie notification would have to do where you do not want to ask the user on every page load and rather store that the user has already accepted your cookies or notification in this case.
Teodor wrote a great post on this here, I think this will help.
Basically you can do this without a form though, all you need is a server action with a database update or insert, and if the notification shows then tell the notification to write a 1 to the database field.