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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / In a form, how to Disa...
Power Apps
Answered

In a form, how to Disable field input if value exists in another field

(0) ShareShare
ReportReport
Posted on by 45

The powerapp user should only enter Amounts or Percentage. 

So if there is an Amount input in the field, then the corresponding percentage should be disabled.

And vice versa, if there is a Percentage input, then the corresponding amount should be disabled. 

This is as the form is completed, and not at time of save. 

 

I tried to set a context variable 'onSelect', but if there is no actual entry, then both fields can still be visible. 

 

PwApp1.JPG

 

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @steph_io 

    Put a radio control to overly the appropriate card in the form (not inside the card) and set the Items property to ["$","%"].  Set the displaymode property of the card to If(Radio1.Selected.Value="$",Edit,Disabled)  Set the other card to If(Radio1.Selected.Value="%",Edit,Disabled).  Set the default property of the radio control to "" and the tooltip property to "Please choose either $ or %".  Do the same for the other fields and use another radio control unless you want all of the fields to be in either $ or %. In the OnSuccess property of the form add Reset(Radio1) and reset all the Radio controls if  you have more than one.

  • steph_io Profile Picture
    45 on at

    Great idea!  If I were to replace the need for 2 fields, by just 1 Amount field and the other is a toggle to determine if the amount entered is a $ or %, how do I write that toggle selection back to the CDS?

    In the CDS I created a Toggle field called 'Vendor Max toggle', which can contain $ or %.  But I'd like the powerapp form to represent this in a toggle control, and not the dropdown provided by default.

     

    Thank you for your help!papps2.JPG

     

     

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @steph_io 

    Put a label inside the control and make its text property Radio1.Selected.Value.

     

  • steph_io Profile Picture
    45 on at

    It displays on the screen in the label, but how can I write back to the CDS field that it should be the selected toggle value?

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @steph_io 

    If you want it to write back as part of the form, you would have to include it in a card.  The other option is to add a Patch() statement to the OnSuccess property of the form.  If you are not familiar with Patch(), it has to include the datasource, the record being patched and the field being patched.  Something like

     

     

     

    Patch(FundDatasource, EditForm1.LastSubmit,{'Vendor Max toggle':Radio1.Selected.Value})

     

     

     

    Where FundDatasource is the name of your entity and EditForm1  is the name of the form.   FYI, best practices calls for using Camel Case when naming fields and avoiding spaces. vendorMaxToggle would be the way I would name the field. 

    Sometimes, when the out of box edit forms don't meet your needs and the workarounds become too complicated, I have found it to be easier to create my own edit forms.  @Meneghino  has a blog post:

     https://baizini-it.com/blog/index.php/2017/09/28/powerapps-101-create-your-own-forms/ 

    that explains how to create your own custom forms.  I learned a great deal about how PowerApps works by going through this exercise and I recommend it highly.   It is now even more relevant since you can use components to create a basic form and reuse it in all your apps. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard