cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phineas
Post Prodigy
Post Prodigy

Update Submit Button DisplayMode Based on Changes in Edit Form

I have an Edit form (Form1).

I have a Submit button with 'SubmitForm(Form1)' in OnSelect.

Is there a way to set the Submit button DisplayMode default to 'Disabled' until any text is changed in any field in Form1?

No changes, individual can click out of screen elsewhere.

If a change is made in any field or to any control in Form1 the Submit button changes to 'Edit'?

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @Phineas ,

 

Please try below approach:

1. OnVisible of the Screen set a variable:

UpdateContext({Mode: true})

2. OnChange of all the input controls such as Text inputs and combo box in the form:

If(Not(Self.Text = Parent.Default), UpdateContext({Mode: false}, UpdateContext({Mode: true})

3. DisplayMode of submit button:

If(Mode, DisplayMode.Disabled, DisplayMode.Edit)

 

However, please note that if user changes some fields then change a part of them back to default, this may not work properly.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

6 REPLIES 6
AhmedSalih
Super User
Super User

@Phineas, use If(Form.Valid && Form.Unsaved, Edit,Disabled) in the Button DisplaMode

 

 

Regards,
Ahmed
If my reply helped you, please give a 👍. And if it has solved your issue, please consider Accepting it as the Solution to help other members of the community find it more.

No changes made to the test data and Submit button is in 'Edit'.

This is not the desired outcome.

Goal: On new screen/screen open the Submit button should be 'Disabled'.

Once any changes are made to the default data in the edit form the Submit button should change to 'Edit'.

Phineas_0-1656889893412.png

 

@Phineas , in your app settings, make sure to enable Formula-Level error Managment:

AhmedSalih_0-1656890421728.png

 

Also, is your form in an edit mode?

 

 

Toggle is on.

Form1 is in 'Edit'.

If I add and exclamation the button is 'Disabled'. However, changes to the form content do not change the button to 'Edit' as desired.

     If(!Form1.Valid && Form1.Unsaved, Edit,Disabled)

AhmedSalih
Super User
Super User

@Phineas , I think your issue is one or more of your form's fields has a default value that is using a lookup. When we use a LookUp to retrieve the default value of the field, the lookup will run when the form is visible and that will be considered as a change. 

v-jefferni
Community Support
Community Support

Hi @Phineas ,

 

Please try below approach:

1. OnVisible of the Screen set a variable:

UpdateContext({Mode: true})

2. OnChange of all the input controls such as Text inputs and combo box in the form:

If(Not(Self.Text = Parent.Default), UpdateContext({Mode: false}, UpdateContext({Mode: true})

3. DisplayMode of submit button:

If(Mode, DisplayMode.Disabled, DisplayMode.Edit)

 

However, please note that if user changes some fields then change a part of them back to default, this may not work properly.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,436)