I have a timesheet form created in Nintex for SharePoint 2013 and the requirement is that in the hours field, only whole numbers or multiples of 0.25 should be allowed. So only the following values should be allowed: x, x.25, x.5 and x.75.
I dont want this to be done through a dropdown option which would contain a lot of entries, as x could be anything. I want it to be achievable through a validation rule, if possible.
Any help in this regard will be highly appreciated.
Solved! Go to Solution.
In a classic form you could try some javascript magic to emulate a field mask in a text box.
If you are not going for javascript or if it is a responsive form you could have two dropdowns.
The first dropdown contains full hours from 0 to 23.
Second dropdown is for minutes, providing 00, 15, 30, 45 minutes options.
A calculated value could combine both values to one value and save it to a separate column.
Would that be an option?
Best regards
Enrico
Thanks Enrico.
It would work but ideally I was looking for a validation rule.
Try below RegEx
^((([0]?[1-9]|1[0-2])(:|\.)(00|15|30|45)?( )?(AM|am|aM|Am|PM|pm|pM|Pm))|(([0]?[0-9]|1[0-9]|2[0-3])(:|\.)(00|15|30|45)?))$
Hi Kunal,
Thanks a lot for this. Its very close to what I want, however, can you please simplify it to just allow whole numbers or multiples of 0.25. So only the following values should be allowed: x, x.25, x.5 and x.75, where x is an integer.
@Nabil1 ....I think @praios81 approach will be much better for you. Instead of putting validation rule and asking users to resolve the issue, it will be more user friendly if you just put 3 dropdowns
Then use hidden calculated control to concatenate 3 values as HH:MM AM/PM and then connect this control to a list column.
@praios81 approach will be more simpler from maintenance perspective too.
Hi @kunalpatel ,
I appreciate your concern, but I do not want to work with time format. I just want them to enter their hours in a number format like 5.50 hours, 6.75 hours etc.
Thats why I request you to simplify your solution above to remove the am/pm bits and just allow numbers in multiples of .25 to be accepted as a validation rule. That will serve my purpose fully. I'll be really grateful.
@Nabil1 ....since you're using SLT control, you use below RegEx:
(?!0\d)\d+(?:[.](?:25|5|75|0)0*)?(?!\d)
@kunalpatel Thank you very much for your help. This is exactly what i wanted 🙂