web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Form is sometimes in r...
Power Apps
Answered

Form is sometimes in read only mode - error when submitting

(0) ShareShare
ReportReport
Posted on by 194
Hello,  I'm getting an error on some records when i go to submit that says  The form you are trying to submit is in read-only (view) mode.  only editable fomrs can be submitted.
 
it doesnt happen on every record that i am trygin t updte, but does appear to happen consistently on certain records.
 
This is the code i am using to submit my updates,
UpdateContext({varGeo: Geos.SelectedItems});
SubmitForm(InfoForm);
SubmitForm(GatesForm);
SubmitForm(Exec);
SubmitForm(ExtraStat);

UpdateContext({editMode: false, newMode: false});
 
 
 
I am getting the error associated with mostly with Submitform(exec) but also Submitform(ExtraStat)
All my forms have this code under the DefaultMode property
If(newMode, FormMode.New, If(editMode, FormMode.Edit, FormMode.View))
 
 
 
And this code on the OnSelect propery of my edit button
UpdateContext({selectedRecord: ProjectGal.Selected, editMode:true});
 
 
Any idea why this works for some records but not others, and what can i do to fix this?
Categories:
I have the same question (0)
  • ialbasheir-kbr Profile Picture
    87 on at
    are all these forms on the same screen? I assume so since you are using a context variables for displayMode. if not please use global variables to make sure all forms you are submitting are in Edit Mode. 
  • Frac Profile Picture
    194 on at
    Yes, they are all on the same screen,  i have it in 4 forms for layout
  • Verified answer
    WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at
    Hi Frac
    The really sure way is to set your form Mode directly before you edit and submit it - the Default Mode does not reset the form if it has been set previously - it is only the initial state of the form.
    EditForm(InfoForm);
    EditForm(GatesForm);
    EditForm(Exec);
    EditForm(ExtraStat);
    then back to View mode when you are finished.
  • ialbasheir-kbr Profile Picture
    87 on at
    I was able to reproduce the error and tested what Warren mentioned and it worked! This makes me think that you may want to check what are doing on the onSuccess property of each form there is a chance your are setting the context variable back to false. {editMode: false}, Which means you are going into a racing condition between these network calls, where one of them invokes onSuccess reseting the editMode variable before the next form is submitted thus you get the error. 
  • Frac Profile Picture
    194 on at
    @ialbasheir, i checked my on success property and you were right, i was setting my editMode to false on every form.
     
    UpdateContext({ CurrentItem: Self.LastSubmit, editMode: false, newMode: false })
     
    What is the best way to get this instruction to run but only after all 4 forms have completed thier update?
  • ialbasheir-kbr Profile Picture
    87 on at
    Remove it for all forms except the last one but what warren mentioned works too!
     
  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at
    Hi Frac 
    Sometimes the simple processes are the best - why bother with Variables when you can set the FormMode directly (and more importantly reliably). The same can be said for a lot of other multi-dependant processes - if they are really not necessary, write some code that explicitly does what you need.
  • Frac Profile Picture
    194 on at
    Thanks Warren & ialbasheir,  i appreciate the help

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard