2

I have an "On/Off" field (default is Off). I have a text field, which is Hidden when my On/Off is Off. When it is On, the text field is visible and mandatory.

However when I try to submit form, with On/Off being Off, the form returns error saying required field not filled.

I cannot see the required text field, because the visible property condition of the text field is working as intended.

When I turn it On the text field becomes visible and it is highlighted in red as required.

Now why would that happen?

The text fields required and visible properties are both "DataCardValue2.Value = true". So the condtitions for making the field visible and mandatory are the same, but the field is hidden and required...

It is as if the text field's required property is evaluating DataCardValue2.Value as true while the same fields visible property is evaluating DataCardValue2.Value as false.

The text field is NOT set as mandatory on the SharePoint List. I thought that might be it, but then I checked...

ATTEMPT: I have tried to set the text fields required property to

"Bestilling_Navn_DataCard1.Visible = true"

Bestilling_Navn_DataCard1 is itself. It was required, even when it was Hidden. I am officially confused :-)

EDIT: Formatting

Jens-Emil
  • 56
  • 8
  • 1
    could you do something like, on your save/submit form perform a check if text field should be filled or not. so you can remove required property and have a check on submit form – AnkUser Oct 26 '22 at 09:54
  • @AnkUser this is a good idea for an alternative procedure, but I don't really know how to do it in practice. I'm going to start trying immediatly. If you happen to know how to do it, would you help? – Jens-Emil Oct 26 '22 at 10:59
  • Hi @Jens-Emil. Did you try solution given in my answer below? is it working for you? – Ganesh Sanap Nov 02 '22 at 09:42
  • Hello, apologies. I have tried that but doesn't work, even if I logically think it should, and still believe it will for anyone else but me haha :-) – Jens-Emil Nov 03 '22 at 10:06

2 Answers2

1

Try settings Required property of text input control to:

Self.Visible

If this does not work, you can validate it on submit. For example, you can use formula like below on OnSelect property of button control:

If(
    DataCardValue2.Value,
    If(
        IsBlankOrError(TextInputCtrlName.Text),
        Notify("Required Field"),
        SubmitForm(Form1)
    ),
    SubmitForm(Form1)
)
Ganesh Sanap
  • 1,386
  • 1
  • 8
  • 18
0

Yes/No columns integrated with Power Apps is apparently always problematic because of a bug which Microsoft aren't fixing... So it's not that mine or other suggested solutions are wrong it's just that power apps has an unfixed bug. Please check Reza's post for more details.

https://rezadorrani.com/index.php/2019/04/14/powerapps-filter-sharepoint-yes-no-column-bug/

Jens-Emil
  • 56
  • 8