cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tiemo_123
Helper II
Helper II

How to make visible field required for navigation, when selected value from radio is "other".

Hi,

 

At the moment the NEXT button on my screen navigates to a different screen if both radios (questions) are not blank.

 

However what I'm trying to do is if radio1 and radio2 are not selected then the textinput field that is not visible - doesn't need to be required to navigate to another screen.

 

I managed to get a field to be visible when selected value from radio if 'other' is selected. This was the code for the visible part on the textinput :

 

If(Radio2.Selected.Value="Other", true, false)

 

On displaymode for my button my code is:

 

If(!IsBlank(Radio1.Selected) && !IsBlank(Radio2.Selected), DisplayMode.Edit, DisplayMode.Disabled)

 

On selected of my button is:

 

Navigate(Screen2,ScreenTransition.Fade)

 

But how can I make the textinput field required only when it is only visible when 'other' is selected on radio2, to navigate to a different screen?

 

3 REPLIES 3
JR-BejeweledOne
Super User
Super User

You cannot make a control required.   You can do a work around though.

 

What I do is add a 5 point star icon ( 10 x 10 ), color: red.    I add it to the left of the 'required' control and set it's visible property to IsBlank(controlName).

 

So in your case, you would set your visible property for your icon to IsBlank(Textcontrol) && Radio2.Selected = "Other"

 

Then set the displayMode property of your button to this:

 

If(
   Star.Visible,
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
tiemo_123
Helper II
Helper II

Thank you for your input. I have found an alternative solution that managed to make the control required. by using If Else structure.  This is seen on the code below.

 

TextInput

 

Visible

 

If(Radio2.Selected.Value="Other", true, false)

Button:

 

DisplayMode 

 

 

(If(
Radio2.Selected.Value = "Other",
If(
IsBlank(TextInput4),
DisplayMode.Disabled,
DisplayMode.Edit
),
If(
!IsBlank(Radio2.Selected) && !IsBlank(Radio1.Selected),
DisplayMode.Edit,
DisplayMode.Disabled
)
))

 

OnSelect

 

Navigate(Screen2,ScreenTransition.Fade)

 

If anyone else has an optimized version of this code, please let me know.

Drrickryp
Super User
Super User

@tiemo_123 

I think this is more concise.  See if it works

If(
    Or(
        Radio2.Selected.Value<>"Other", 
        !IsBlank(Radio2.Selected.Value)
    ) && !IsBlank(Radio1.Selected.Value), DisplayMode.Edit,
    DisplayMode.Disabled
)

 

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,962)