cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dorinda
Responsive Resident
Responsive Resident

Complicated conditions to disable Text Input Field

@RandyHayes @mdevaney ,

I have formulas like this one

If(

    If(

        Value(label_year.Text) < Value(CurrentYear.Text),

        false,

        Value(CurrentMonth.Text) <= ThisItem.Month Or Value(label_year.Text) > Value(CurrentYear.Text)

    ),

    DisplayMode.Disabled,

    DisplayMode.Edit

)

 

Basically if the current year and current month are in the past they should be set to Disabled, otherwise they should be set to Edit.  As you can see 2019 and 2020 in blue both are editable.

id.jpg

The other issue with this is now in 2022 or any later year that fields that should be open to enter information is greyed out and the open ones in blue when you type anything immediately grey out even if you are not finished.  This is what is in that Original field If(IsBlank(TextInput2_6), DisplayMode.Edit, DisplayMode.Disabled)

 

id2.jpg

 I am stumped why this is not working

 

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Dorinda 

The formula that seemed to do the trick was:

If((IsBlank(ThisItem.RevForeCast) && (Date(ThisItem.Year, ThisItem.Month, 1) > Date(Year(Now()), Month(Now()), 1))) || 
    (Date(ThisItem.Year, ThisItem.Month, 1) = Date(Year(Now()), Month(Now()), 1)), Edit, Disabled)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
gabibalaban
Super User
Super User

Hi @Dorinda ,

 

Try a different approach to avoid the "complicated condition". 😊. What about ...

 

 

If(
Value(label_year.Text)*12+ThisItem.Month < Value(CurrentYear.Text)*12+Value(CurrentMonth.Text),
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

 

 

Hope it helps !

WarrenBelz
Super User
Super User

@Dorinda ,

This should work

If(
   Value(label_year.Text) > Value(CurrentYear.Text) ||
   (
      Value(CurrentMonth.Text)>= ThisItem.Month &&
      Value(label_year.Text) = Value(CurrentYear.Text)
   ),
   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.

RandyHayes
Super User
Super User

@Dorinda 

The formula that seemed to do the trick was:

If((IsBlank(ThisItem.RevForeCast) && (Date(ThisItem.Year, ThisItem.Month, 1) > Date(Year(Now()), Month(Now()), 1))) || 
    (Date(ThisItem.Year, ThisItem.Month, 1) = Date(Year(Now()), Month(Now()), 1)), Edit, Disabled)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,775)