Skip to main content

I have a number field currently that accepts all values. I want to add a validation/condition that would restrict the field to only accept positive values (values >= 0) 

How do I do this?

Hello ​@Radha 

Welcome to the DocuSign Community!

Currently you cannot apply the custom validation on the number type field in document generation. Now instead of the Number field, you can use the Text field and add the Customer regex validation which exactly full fill the requirement. Here is the Regex.

Regex: ^(?!0(\.0+)?$)(\d+(\.\d+)?|\.\d+)$

Thank you, Hope it helps!


Thank you for this solution, ​@Pawan Gangwani!

There is a slight problem here though. The number field is already referenced in multiple places, and I don’t think I should be changing it to a text field. Any workaround possible?


Thank you for this solution, ​@Pawan Gangwani!

There is a slight problem here though. The number field is already referenced in multiple places, and I don’t think I should be changing it to a text field. Any workaround possible?

Then the only workaround here is at the workflow level.

1. In the workflow identify the field having negative value using the c# code.
2. Conditionalize the workflow, to give user the option to validate the field again for example get the new Doc Gen in middle to rectify the filed. and there you can use the text field and put regex.

Thanks!


Reply