How to perform field level validations in Clinical observation forms using regular expressions?

I am trying to validate one numeric data type concept of observation form , which will allow to enter numeric value in specific range like (Allow only 3 digit).

I am taking reference of Registration form first page of Bahmni EMR of the person attribute “primaryContact” where validation is used like user will able to enter only 8 – 10 digit for primaryContact.

Till now I have tried with following things:

1.I have gone through “fieldvalidation.js” on the path : “/var/www/bahmni_config/openmrs/apps/registration/” and I have crated same “fieldvalidation.js” file at path “/var/www/bahmni_config/openmrs/apps/clinical/”.

2.I have gone through “app.json” in “/var/www/bahmni_config/openmrs/apps/registration/” and used same concept ““fieldValidation” : { “primaryContact”: {“pattern” : “[0-9]{8,10}”, “errorMessage” : “Should be 12 characters starting with 91 (country code)”} }” in “/var/www/bahmni_config/openmrs/apps/clinical/app.json”.

3.I have tried with following file clinical.min.f6d114d8.js Path: /etc/bahmni-web/bahmniapps/clinical/clinical.min.f6d114d8.js Added following code in the “clinical.min.f6d114d8.js”: “$rootScope.fieldValidation = appService.getAppDescriptor().getConfigValue(“fieldValidation”);”

Am I missing anything to configure or Is there any other way for achieving the concept level validation for the observation form.

For Observation Forms, have a look here

Hello @angshuonline I tried to use this in “app.json” file, “breathingRate”: { “required”:true, “validator”: { “validate”: function(context){ alert(‘json function’);} } }, but I’m getting the following error

It’s not allowing function in json file.