Advanced Case Management Tutorial Part 5 - How to Create an Edit Form



The following instructions demonstrate how to make data in your application editable by creating an edit form.

This page walks you through the general procedure, and also gives an example of how to do this in a real application.

General Instructions

  1. Create your Registration form, including all questions. Make sure to build this as a registration form, in a case list type module. (Note: the same can be done with a follow up form, if you'd like some of these questions to be editable, too).

  2. Save all of the questions you want to be editable as case properties, in the case management tab of your form settings page.

  3. Create a new follow up form. This is your Edit form. Name it something like “Edit Registration” or “Edit Person Details”

  4. Go into the registration form (or any other form you want to make editable), and copy all the questions you want to edit.

  5. Paste those questions into your Edit form

  6. OPTIONAL: In your Edit Form, create a checkbox question that asks the user “Which fields would you like to edit?” and has all the answer options of the questions they can edit.

    1. (If you did Step 6) Put display conditions on all the questions in your edit form that only show the question if the user ticked off “Which fields would you like to edit?” for that particular form.

    2. Go into every question in your edit form, and drag and drop the case property into the default value box for the question. For example, if you have a question date of birth, drop the dob case property from the app properties box into the default value box.

    3. Once you are done putting all your default values and display conditions in your form, go to the case management tab of your Edit form. Save all the questions as case properties. This will ensure that the edit form makes changes to the case.

Example

To be able to edit information in a CommCare Application, the information we want to be editing has to be saved in a case. More detailed examples of case management can be found here. The example below shows how a case is created and information is updated.

Case: We have a football team composed of 14 players, a coach and a captain. Upon registration of the team the information about the players, coach and captain is entered. But with time the captain and coach can be changed.

In this case the team will be the case, the coach and captain will be information saved to the case.

Step 1: Create the case

  1. In commCareHQ click ADD and then choose “Case List” with case type “team.” A case list will be created.


2. Add the registration form and create the questions, in this case will be, name of team, number of players, captain’s name, the coach’s name, name of club, date of registration.

Step 2: Save Information on the Case

Save the information that needs to be edited in the case list by clicking the button manage case on the top right side of the screen and save the questions that need to be accessible in other forms in the case properties

Step 3: Create the follow up form

The followup form will be used to update information about the captain and the coach. 

  1.  In the follow up form use the App properties tab to navigate on thru the saved cases properties


2. Create the fields that are going to receive the new values, and fill the default value with the equivalent  case property, in the example below the app is updating the coach value and use as a Default value the saved case property. Configuring the application this way means that the user will see the previous value before updating.

Step 4: Save the information in the case

While the follow-up  form is opened, select the option Manage Case , then proceed to save the questions on the case property. Make sure you have the case property named exactly the same as you named before in the registration form otherwise the edit form will not overwrite the correct properties.

Optional Section

In addition to this, here are some other enhancements you can add to help usability for your workers

  1. Show the information about the team

 Put a label and for each case property, drag and drop to the label display text

2. Choose which information to edit

insert a multichoice question that asks which information to edit

3. In the question, add the display condition