Dear DHIS2 family
How do we disable and enable data entry fields in DHI2? We have some data elements and indicators that we need to disable on the entry field side for a specific time and enable gain for a specific time frame. We want to manage our users so that they don’t enter incorrect data at the wrong time.
Dear DHIS2 family
Is this for the Data Entry app (aggregate data set,) Event program, or Tracker program? Could you please explain more about the use case to see if there are other possible solutions to approaching the same result?
@Gassim hope to find you well.
See the picture below, data entry appy . Is there way to disable user to enter data into a specific field or data elements in this case for example to disable data entry on field 25-59
/5-9 or to disable the whole data element for a certain period of time and enable later .
First of all, maybe you can create a feature request for this to be a feature in the new Data Entry app (Beta)?
From your post:
- Disable specific fields from certain user (user groups)
- Disable specific fields for a certain period
However, for now I can suggest some workarounds:
This is a bit complicated but here’s the scenario. If you or a developer who can create the script, it should be possible. For the input fields to be disabled, create a script that will disable them by default i.e. for each input field add a CSS class name and then run the script
document.getElementsByClassName('CLASSNAME_HERE').disabled = true; and then since it’s not functional to use timing here, you find it helpful to create a password input which only certain users will know and if they enter the correct password then change ‘true’ to ‘false’ .
Using the dataset settings ‘Complete allowed only if validation passes’ & ’ Complete allowed only if compulsory fields are filled’, and then create a compulsory field with a validation of a specific number example 1.5956 [this will only stop users from unintentionally pressing complete]
It helps a lot more when the use case is shared and this is ultimately how innovations are developed, so if you decide to create a feature request, maybe more info about the necessity for these settings and configurations (disabling input fields for certain users during certain periods of time)
Either a different approach based on best practices will be suggested or a feature could be requested.
Hope you find this helpful!
@Gassim thank you . Its not yet clear though . I still have a lot of work to be done to make it work .
I recommend creating a feature request (disabling/enabling fields for certain users and for certain periods) for the new Aggregate Data Entry (Beta) app. If you would like to create a feature request please use this site: https://dhis2.atlassian.net/ (you will need to create an account if you don’t already have one.
Please share the link to the ticket here so others can find it and vote for the same feature.
@Gassim I got this solution where you to data set, manage section, manage grey fields. This where you disabled all the field that you don’t want to be entered. The functionality is working well when use DHIS 2 Demo - Sierra Leone platform while when I tried to use our DHIS2 same version is not working. I can be able to disable the field but when I go to the entry side the fields are still accepting the entries. What might be the issues, where should I configure or sort out.
Check the image for the demonstration in DHIS 2 Demo - Sierra Leone
Great, thanks for sharing!
If you are using a superuser account this might be the case. Please try to use a user with lower authorities and check again.
If the issue is still the same even for non-superusers then would check if there areany errors showing up in the console or network tabs in the browser’s DevTools (F12)?
I think this setting is for all users, right? (And not for specific users? and period?)
@Gassim when you say use user with lower authorities. What lower authorities exactly. I am failing to get the solid solution . What else should i do and try