Prompt to save entered registration info if the "Home" icon or "Search" accidentally pressed

Is there a way to do this? It happens a lot on tablets especially when taking photos because of this issue


@shivtej Could you please have a look at here? Hope you can :slight_smile:

@ouiliam, thanks for letting us know the issue. I would create an issue and soon it will be solved.

@ouiliam I am a bit confused here. The header talks of a “prompt for confirmation on moving out of the registration page” while the post talks of using rear camera.

If your question is about “prompt for confirmation on moving out of the registration page” => currently we have this sort of behavior in clinical consultation and the configuration for this can be found here. But we don’t have this behavior in registration. It requires code change in bahmni apps.

@shruthipitta, I just mentioned the rear camera issue because that was causing us to accidentally hit the “search” or “home” buttons often, and lose all entered data. We have fixed the camera issue, but I still think it’s worth changing bahmni apps code to have registration behavior consistent with clinical app, i.e. an option to enable the prompt to save.

+1 to having this behavior be consistent.

@ouiliam can you create a JIRA ticket for this? (I’m not sure when it would be prioritized, but it’s helpful to have in the backlog.)

@darius done

Hey people, after working on the Jira ticket ,I’ve reached the following conclusions:

  1. Navigating away through
  • Clicking on Search button

  • URL change

  • Navigating away from patient registration page

  • Clicking the Chrome’s back button triggers the confirmation prompt to appear as it does in ‘clinical’.

  1. The above prompt is enabled through the following config being set to true in registration/app.js: “showSaveConfirmDialog” : true

  2. However “stateChangeStart” and “locationChangeStart” are not getting triggered for the Home button and preventing to leverage the above functionality.There is a solution that by creating a common service we can achieve the functionality,but its complex for the current implementation and will require a lot of code changes

  3. The desired outcome is achievable by setting an “id” attribute to the Home button and calling a function when the button is clicked.Id added here

Just wanted to know,how many people are up for the “id based click event” solution?

1 Like

@darius, hooking the clicking on ‘Home’ navigation away to the same built-in Angular events seems to complicate things quite a lot because they would have to be handled across two Angular apps.

I looked quickly (like really quickly) and this would require to scaffold services to share those events cross-apps.

While I don’t like it so much on the principle, it appears that simply hooking an on-click event to the button itself might just be a satisfactory solution for the time being.