jarerasika
(Rasika Jare)
February 26, 2021, 8:00am
1
Hello Team,
I want to make the “Middle Name” field and “Photo Capture” mandatory on the registration first page.
What I have figured out till now:
In app.json in registration I got configuration for patients Last Name mandatory i.e. “isLastNameMandatory”: true which is working properly
I tried it out the same for Middle Name mandatory as “isMiddleNameMandatory”: true but it is not working.
Is there any configuration to make “Photo Capture” mandatory on the registration first page in Bahmni ?
Could you suggest any configuration that I should try?
gsluthra
(Gurpreet Luthra)
February 26, 2021, 11:35am
2
I feel you should be able to do this with customValidator.js copied into config registration folder.
See this documentation on wiki:
https://bahmni.atlassian.net/wiki/spaces/BAH/pages/3506184/Registration+Page:
Section: Registration Page Custom Field Validation Configurations
See some sample registration screen validation scripts written by other implementations:
Sample1:
Bahmni.Registration.customValidator = {
"age.days": {
method: function (name, value) {
return value >= 0;
},
errorMessage: "REGISTRATION_AGE_ERROR_KEY"
},
"Telephone Number": {
method: function (name, value, personAttributeDetails) {
return value && value.length> 6;
},
errorMessage: "REGISTRATION_TELEPHONE_NUMBER_ERROR_KEY"
},
"caste": {
method: function (name, value, personAttributeDetails) {
return value.match(/^\w+$/);
},
errorMessage: "REGISTRATION_CASTE_TEXT_ERROR_KEY"
}
};
Sample2:
var showOrHideLegalRepresentativeSection = function (patient) {
var returnValues = {
show: [],
hide: []
};
if (patient["age"].years < 18) {
returnValues.show.push("LegalRepresentative")
} else {
returnValues.hide.push("LegalRepresentative")
}
return returnValues
};
Bahmni.Registration.AttributesConditions.rules = {
'age': function (patient) {
return showOrHideLegalRepresentativeSection(patient);
},
'birthdate': function (patient) {
return showOrHideLegalRepresentativeSection(patient);
This file has been truncated. show original
@gsluthra Thanks for the reply.
I tried the above configuration but it did not work.
I have used the alternative solution i.e. to add “non-blank pattern-validate” in bahmniapps for file /app/registration/views/patientCommon.html which is working as expected.