0

I am working on a SharePoint Online Modern Form solution using the OTB conditional formatting. There are three rules that I am trying to apply, here is the example.

Two Columns:

  1. COL1 - Choice Field - Yes, No
  2. COL2 - Single Line of Text

The rule is: If you choose 'Yes' for COL1 then you have to fill out COL2

I currently have: =if([$COL1],'true','false'). This conditional formatting works to hide/show COL2 when COL1 = Yes.

Here is what I'm looking to accomplish:

  1. If you choose 'Yes' in Col1, COL2 becomes REQUIRED.
  2. If you choose 'No' in COL1, COL2 must be NULL/Blank.

1 Answer 1

1

You have to use the SharePoint List validation settings for your requirements.

Use list validation formula like:

=IF([Col1] = "Yes", NOT(ISBLANK([Col2])), IF([Col1] = "No", ISBLANK([Col2]), TRUE))

Note:

  1. Sometimes comma(,) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon(;) instead of comma(,).
  2. Use correct display name of your SharePoint columns in above formula.
  3. Wrap column names inside [] if your column name has space in it. For example: [My Column Name].

You can find the steps to add list validation formula in below threads:

Similar threads:

  1. How to have validation for calculated column
  2. List Validation syntax error
  3. SharePoint list validation formula issue
1
  • 1
    This worked perfectly! Thank you Oct 31, 2023 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.