Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

For example, in a workflow task, I might have a master field called "Approve" which, if set to "No", makes it unnecessary to complete the rest of the form (and thus makes them non-mandatory). Is there a clean way of implementing this?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

For instances like that, in the past I've marked all the fields optional in the list then created a custom new/edit form and included jQuery and PreSaveAction() to do my own logic.

I'd have the Approve column visible with everything else hidden. If they select no, then they can save the form with nothing else required. If they select Yes, then the remaining hidden fields become visible.

share|improve this answer
    
But the user will still be able to submit the form without completing the fields, won't he? –  Mihai Sep 12 '11 at 17:33
    
You can use validation logic on the form fields. I've used PreSaveAction() in the past to force validation on optional fields that I want to make mandatory based on conditions. –  PirateEric Sep 12 '11 at 17:40
add comment

This really depends on how you implement the forms in the fields. If you customize them with InfoPath, you can use conditional formatting to make fields mandatory by using rules. You can set a rule like: If Field1 = "yes" then Field 2 cannot be blank. This would make it mandatory based on the answer.

share|improve this answer
    
Unfortunately, I'm using Visual Studio/ASP.NET. I should have specified it in the question. –  Mihai Sep 12 '11 at 17:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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