0

I have a sharepoint list where I have a series of questions.

The first question in the series is a YES/NO question, and it states if the answer is no, there is no need to answer the next few questions/or even better if sharepoint can auto generate Not Applicable as the answer but if your answer is YES, you MUST answer question 1 to 6. Please keep in mind, there are other columns in the list but I only want to validation to be applied to the 7 questions (first one being yes/no, other 6 being the follow up questions).

Can someone please help me, I've tried everything :(

1 Answer 1

0

1. Make a field Conditionally Required

Because it's referencing the value of a different column, you'll have to use the List Validation settings rather than the Column Validation setting. This is located on the List Settings page under the General Settings heading.

You can use:

=IF([My Checkbox Column],NOT(ISBLANK([My Required Field])),TRUE) 

...if the determining column is a checkbox column.

If the determining column is a choice or text field you can use:

=IF([My Choice Column]="Yes",NOT(ISBLANK([My Required Field])),TRUE)

(Replace My Checkbox Column, My Choice Column, and My Required Field with the actual titles of your columns.)

What this formula is saying is this: if the user picks yes, then be valid only if the required field is not blank; if the user picks no, be valid.

That takes care of making one of your fields conditionally required, so now you just have to apply it to all of them.

2. Making multiple fields conditionally required

If you have a second formula that you need to validate, you can lump them both together inside an AND() function in the list validation formula. This will only evaluate to true if both formulas are true.

=AND([first formula],[second formula])

This could get to be a pretty ugly formula depending on how complex the validations need to be. If it gets too long, you can offload some of the complexity into one or two calculated columns, then reference and compare the calculated columns directly in the validation formula.

As a general rule, create one calculated column which evaluates to true or false for each of the conditions you want to validate, then simply compare the calculated columns within the AND() function, nesting multiple ANDs as necessary.

=AND([First Calculated Column],AND([Second Calculated Column],[Third Calculated Column]))

Keep in mind that you'll need to make your "User Message" generic enough to handle any of the things that might have been wrong with the form input.

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.