Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Form is sometimes in read only mode - error when submitting

(0) ShareShare
ReportReport
Posted on by 192
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:
  • Frac Profile Picture
    192 on at
    Form is sometimes in read only mode - error when submitting
    Thanks Warren & ialbasheir,  i appreciate the help
  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Form is sometimes in read only mode - error when submitting
    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.
  • ialbasheir-kbr Profile Picture
    71 on at
    Form is sometimes in read only mode - error when submitting
    Remove it for all forms except the last one but what warren mentioned works too!
     
  • Frac Profile Picture
    192 on at
    Form is sometimes in read only mode - error when submitting
    @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
    71 on at
    Form is sometimes in read only mode - error when submitting
    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. 
  • Verified answer
    WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Form is sometimes in read only mode - error when submitting
    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.
  • Frac Profile Picture
    192 on at
    Form is sometimes in read only mode - error when submitting
    Yes, they are all on the same screen,  i have it in 4 forms for layout
  • ialbasheir-kbr Profile Picture
    71 on at
    Form is sometimes in read only mode - error when submitting
    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. 

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard