cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Manny123
Helper III
Helper III

Powerapps Radio Button selected validation

Hi Team,

 

I was wondering if anyone could help.  I have SharePoint List and Powerapps which saves user questionnaire results.

There are the 5 questions a user completes and each question is saved on a different screen in Powerapps.

At the bottom their I have 2 navigation buttons which the user either go back to a previous question OR go to the next question.

 

Each question is using Radio in the form. Each Radio show 4 options. User can only select One answer and MUST complete each question before they move onto the next question. 

How do I build a validation rule on the "next" navigation button so it will flag an error message asking the user to select an answer before moving to a different question?

I have tried the formula below but its not working......

If(!IsBlank(Radio2.Selected.Value), Navigate(Question_2),"Please select a question")

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi @Manny123 ,

You're on the right track, you just need to display your message somewhere - the OnSelect: property needs an action, and you're giving it Navigate() if Radio2 isn't empty (which is fine), but you're just giving it a string if the radio is empty which is why it doesn't work.  A string by itself is not an action.  Try this;  

 

 

If(!IsBlank(Radio2.Selected.Value), Navigate(Question_2), Notify("Please select an answer", Warning, 3000))

 

 

This passes the string to the notify action and should pop up a notification for you if the user clicks while the radio is empty.


You can also do things like disable the Next button or make it invisible until an option is selected by using the DisplayMode or Visible properties of the button and similar IsBlank() Radio logic.

 

Hope this helps,

RT

View solution in original post

4 REPLIES 4
Nogueira1306
Super User
Super User

OnChange or OnSelect proeprty of the RadioBox set a var

Set(varQuestionAnswered, true);

So, when the user selects one answer, you set the var true and you check if that is true or not


 

If(varQuestionAnswered, Navigate(Question_2),"Please select a question")

 

Something like that... If you use a checkbox it might be better because you can use OnCheck and OnUncheck but if you do so you have to block the other CheckBoxe (it is not hard but it will give you more work)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

My website!

RusselThomas
Microsoft
Microsoft

Hi @Manny123 ,

You're on the right track, you just need to display your message somewhere - the OnSelect: property needs an action, and you're giving it Navigate() if Radio2 isn't empty (which is fine), but you're just giving it a string if the radio is empty which is why it doesn't work.  A string by itself is not an action.  Try this;  

 

 

If(!IsBlank(Radio2.Selected.Value), Navigate(Question_2), Notify("Please select an answer", Warning, 3000))

 

 

This passes the string to the notify action and should pop up a notification for you if the user clicks while the radio is empty.


You can also do things like disable the Next button or make it invisible until an option is selected by using the DisplayMode or Visible properties of the button and similar IsBlank() Radio logic.

 

Hope this helps,

RT

Hi RT. Think works so the message comes up when user does not select from the radio selection. However I am small issue that when a user does select from the radio selection the message still comes up and user cannot go to question 2. 

I am clearly doing something wrong. Any advice?

The code you mentioned above I used on the "next" navigation button. 

The OnSelect for the Radio2 is false.

The OnChange for the Radio2 is false.

 

The data from the radio control has come from a SharePoint list. The user can select 4 options from the Radio control.

 

Manny123
Helper III
Helper III

Actually ignore my previous comment above. It works now. Error was due to an input error from me.

 

Thanks RT.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,736)