Skip to main content
Nintex Community Menu Bar

Allow only certain numerical values in a Nintex form

  • September 30, 2019
  • 8 replies
  • 49 views

Forum|alt.badge.img+2

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.

8 replies

Forum|alt.badge.img+12
  • Nintex Partner
  • September 30, 2019

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


Forum|alt.badge.img+2
  • Author
  • September 30, 2019

Thanks Enrico.

It would work but ideally I was looking for a validation rule. 


Forum|alt.badge.img+12
  • Scholar
  • September 30, 2019

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)?))$


Forum|alt.badge.img+2
  • Author
  • October 1, 2019

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.


Forum|alt.badge.img+12
  • Scholar
  • October 1, 2019

@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

  1. For Hours in HH format (01-12)
  2. For Minutes in MM (00,15,30,45)
  3. For AM/PM

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.


Forum|alt.badge.img+2
  • Author
  • October 2, 2019

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.


Forum|alt.badge.img+12
  • Scholar
  • October 2, 2019

@Nabil1 ....since you're using SLT control, you use below RegEx:

 

(?!0d)d+(?:[.](?:25|5|75|0)0*)?(?!d)


Forum|alt.badge.img+2
  • Author
  • October 2, 2019

@kunalpatel Thank you very much for your help. This is exactly what i wanted :)