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

If fx help

Hi

Struggling a bit with the syntax

I have a form, I would like to allow only a user selected in DatacardValue27_1 to be able to edit it, but if the form is completed, I've set it to go into View mode, but I cannot set the save button to disabled.

Currently on the Save Button DisplayMode property I have:

 

If(VarUser = DataCardValue27_1.Selected.Email, DisplayMode.Edit,DisplayMode.Disabled ||If(Form1.DisplayMode=DisplayMode.View, DisplayMode.Disabled, DisplayMode.Edit))

 

Issue with this is on an item which is set to DisplayMode.View the button is still clickable, although the form is in not editable even by the logged in user who is selected in the datacard (VarUser)

 

I've tried this also but get a red line error:

 

If(VarUser = DataCardValue27_1.Selected.Email, DisplayMode.Edit,DisplayMode.Disabled, If(Form1.DisplayMode=DisplayMode.View, DisplayMode.Disabled, DisplayMode.Edit))

 

I'd like the save button to be disabled even if the logged in user is the person selected in the datacard, IF the form has been set to ViewMode

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @G99 ,

I was in syntax modifying mode rather than code examination mode - I will add some foolproof code as well. I assume you have this on the DisplayMode of the button.

If(
   Form1.Mode = FormMode.View
   DisplayMode.Disabled
   If(
      VarUser = DataCardValue27_1.Selected.Email
      DisplayMode.Edit,
      DisplayMode.Disabled
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User III
Super User III

Hi @G99 

Try

If(
   VarUser = DataCardValue27_1.Selected.Email &&
   Form1.DisplayMode <> DisplayMode.View
   DisplayMode.Edit,
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

 

The same behaviour as I had with my fx, it sets the item to view mode, but the button stayed clickable and not disabled:

 

If(
    VarUser = DataCardValue27_1.Selected.Email &&
    Form1.DisplayMode <> DisplayMode.View,
    DisplayMode.Edit,
    DisplayMode.Disabled
   )

Hi @G99 ,

I was in syntax modifying mode rather than code examination mode - I will add some foolproof code as well. I assume you have this on the DisplayMode of the button.

If(
   Form1.Mode = FormMode.View
   DisplayMode.Disabled
   If(
      VarUser = DataCardValue27_1.Selected.Email
      DisplayMode.Edit,
      DisplayMode.Disabled
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (52,247)