Hi,
I have to buttons which can't be both in the same time positive.
I want that if one is true the other will be false, and the opposite.
I have tried to set the default value with:
If (DataCardValue10=true,false,true)
But I receive error.
Can someone help me please?
BTW I want to have the option for both to be false
(So the options are: 1. true, false 2. false, true 3. false, false)
@WarrenBelz Amazing! you are the best!
Hi @moshem ,
I had a chance to test it this time - try the following (replace all of the first one) - and they are toggles, not Radio buttons and note the change to OnSelect from OnChange
Toggle1 OnSelect
UpdateContext(
{
varToggle1: !Self.Value,
varReset: false
}
);
Reset(Toggle2)
Toggle2 OnSelect
UpdateContext(
{
varToggle2: !Self.Value,
varReset: false
}
);
Reset(Toggle1)
Default of Toggle1
If(
varReset,
false,
varToggle2
)
Default of Toggle2
If(
varReset,
false,
varToggle1
)
Reset button and Screen OnVisible
UpdateContext(
{
varToggle1: false,
varToggle2: false,
varReset: true
}
);
Reset(Toggle1);
Reset(Toggle2)
As below
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.
Visit my blog Practical Power Apps
create two variables (var_radio1, var_radio2)
- set default value of radio button with these variables
- use 'OnSelect' function in Radio1 and paste:
Set(var_radio1,Self.Selected.Value);Set(var_radio2,If(Self.Selected.Value = "Yes","No","Yes"))
- use 'OnSelect' function in Radio2 and paste:
Set(var_radio2,Self.Selected.Value);Set(var_radio1,If(Self.Selected.Value = "Yes","No","Yes"))
I have tried to uplaod a vid of the issue but it is an invalid file type here.
I'll put screen shots:
1) I have the code on screen:
2) Now one of them is always false:
3) Even when I press reset form it doesn't help:
4) I have tried to add a button with the code of both to false and it didn't help:
@moshem ,
Run the code I provided for Screen OnVisible - it will set both values to False
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.
Visit my blog Practical Power Apps
@WarrenBelz hi,
2/3 of the original question where answered
I need to have 3 options:
1) false true - you have answered
2) true false - you have answerd
3) false false - which you have made as the defualt but a user can't go back to this option if he by mistake chose one of the other options
@moshem ,
Firstly, has your original question been solved? I also do not fully understand the logic of your current question.
Thank you @WarrenBelz Now it is the opposite, but I need to have the option for false and false, and now if the user once chose true for one of the options he can't make both false again (it is false only in the default view)
Hi @moshem ,
Firstly, you cannot base them off each other or you will have a circular reference, so set a Variable on the OnChange of each = Radio 1
UpdateContext({varRadio1: !Self.Value})
and the other Radio 2
UpdateContext({varRadio2: !Self.Value})
and the Default of Radio1
varRadio2
and the Default of Radio2
varRadio1
make sure at Screen OnVisible to initiate the Variables
UpdateContext(
{
varRadio1: false,
varRadio2: false
}
)
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.
Visit my blog Practical Power Apps
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473