I have a survey (or SharePoint list) powered by InfoPath on my SharePoint site. I was wondering if there is any way, using the rules functionality, to make two specific fields mandatory or required on Mondays only. Basically, if the person selects a Monday in the date field, the 2 other fields would be come mandatory.

enter image description here

enter image description here

enter image description here


Create a new field named "weekday" as type integer (whole number). Create a rule on your date field to set the value of weekday to the following formula:

(number(substring(., 9, 2)) + number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) / 12))) + floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) / 12))) / 4) - floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) / 12))) / 100) + floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) / 12))) / 400) + floor((31 * number(number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) / 12)) - 2)) / 12)) mod 7

Then, simply set a validation rule on the desired field with a condition of "Weekday = 1".

The above formula is from this post.

edit: the condition should be "weekday = 1 AND somefield is blank". This way, the rule will prevent the submit when both of those conditions are true. Also, make sure you put a "screen tip" in the rule, as without it, the rule doesn't fire.

  • Thank you Mike! Follow up questions: 1) When I add the "weekday" field, should that just be a single line of text or a date and time type? 2) Then, where do I create the rule on the value of weekday? I have to associate that rule with the original date field? – Erin A Mar 20 '17 at 20:35
  • 1
    I updated the post with the data type of weekday. The validation rule goes on each field you're trying to require on mondays. (so there are two rules in play, one is an action that sets the value of weekday. Weekday will have a number from 0-6, depending on the day of the week, courtesy of the extremely long formula. The validation function goes on any field that should be required on monday) – Mike2500 Mar 20 '17 at 20:39
  • Thanks Mike. I took the following steps but it does not seem to be working. I'm sure this is user error. Can you advise what I might be missing? 1. Created new "number" field entitled Weekday 2. Created action rule on the Date field and created action rule asking that Weekday Field value be set against formula you provided (see image 11111 above) 3. Created validation rule on 2 other questions that I want to populate ONLY on Mondays and said run only when weekday is equal to 1 (see image 22222 above) When I attempt to fill out the form, look at image 33333 above... not working? – Erin A Mar 22 '17 at 18:26
  • 1
    For the formula, when you click on add--> set a field's value --> value, don't paste it there, but first click on the "fx" button to bring up the formula editor. Then paste the formula. – Mike2500 Mar 22 '17 at 18:35
  • 1
    Either check to make sure that the weekday field is set up as a number, or adjust the condition to be based on the true/false instead of the weekday number. – Mike2500 Mar 22 '17 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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