We are currently working on a fillable form that has various radio buttons, text fields and dropdown menus. Each field is connected to our database where it writes and reads from.
Due to some users occasionally forgetting to save, we wanted to implement autosaving in the background using a timer. After 10 minutes, the timer runs the code in OnTimerEnd, which is
UpdateContext({FormDisabled: true}); SubmitForm(Form1);UpdateContext({FormDisabled: false})
When that runs, all the changes are successfully recorded in the database. However, if I change the value of a radio button and change the value in a text field before it saves, the radio button goes back to being blank. The database shows that the value has changed but the radio buttons are failing to reflect that. It works correctly if I only change the value of the radio button and nothing else.
I've attached an image of what our settings currently are for the radio button, the data card that contains it and a text field under the data header. Please let me know if more information is required.
The autosaving also causes lag and the user loses what they were typing during the saving process. Is there a better way to implement the autosaving process to improve the speed and remove this odd behaviour in the radio buttons?
Hi @Anonymous,
Small suggestion to de delay in autosaving.
Try temp saving the data to a collection & write the data to DB when the user actually presses the save button.
This way, PApps dosnt have to acce the DB each time your time job runs its course.
Cheers.
Hi @Anonymous,
Could you please share a bit more about the data source within your app?
Where do you use the FormDisabled context variable within your app?
I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:
Set the OnVisible property of the Edit screen to following formula:
UpdateContext({TimerStart:true})
Set the AutoStart property of the Timer control to following formula:
TimerStart
Set the Duration property of the Timer control to following formula:
60000
On your side, it is:
60000*10
Set the OnTimerEnd property of the Timer control to following formula:
SubmitForm(EditForm1)
Set the Visible property of the Timer control to following formula:
false
Set the OnSuccess property of the Edit form control to following formula:
Back();UpdateContext({TimerStart:false})
The GIF image as below:
Please take a try to remove the UpdateContext() function within the OnTimerEnd property of the Timer control, then check if the issue is solved.
If the issue still exists, please take a try to re-create your app, then check if the issue still exists.
In addition, if you want to save your form data automatically within PowerApps, I think there is no other way to achieve your needs except using Timer control currently.
Best regards,
Kris
Thank you for the suggestions Kris. Unfortunately, it didn't fix the problem. I do have more information though.
Our data source is a database on our SQL server. It's connected and everything seems to update correctly. It is only the radio buttons that don't stay selected. It continued after I removed the timer and only used a save button.
The problem only happens when I edit a label and don't change the radio button. This is an example of the steps that cause this:
1. I open the form and set the radio button to "Yes"
2. I save the form
3. I change the text of a label to something else and then hit save. The radio button shows nothing is selected. The database shows that it is set to "Yes".
If I change the radio button to a "No" then regardless of whether I edit a label or not, the radio button will show that. If I then keep that radio button with "No" selected and then change a label, it will disappear and both buttons become blank.
This happens when the save button is only running SubmitForm. I set up a label to show which button was selected for that radio button pair and it is shows that the correct button is selected. It just doesn't show the filled in radio button.
Our OnSuccess value for the Form is currently
Set(displayItem,Collect('[dbo].[Intake_form]',displayItem))
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
214 | |
205 | |
86 | |
58 | |
38 |