How to use Address Hierarchy Module with the XForms Module

I’m using xforms’ patient registration instead of default registration app. I know that if I used default registration app, I would add personAddressHierarchy to configs in “Mange App” section, but no idea how to use Address Hierarchy Module with the XForms Patient Form. Can anyone help?

The xforms module uses a different strategy to populate the address fields. Can you start by duplicating your patient registration xform at qa-refapp.openmrs.org and then i guide you on the next steps?

About copying your xform, you can take a look at “Copying xforms between servers” here: https://wiki.openmrs.org/display/docs/XForms+Module+User+Guide

After we have gone through the above, you could volunteer to update the documentation with what you have learnt. :smile:

qa-refapp.openmrs.org But there’s no XForms Module installed

Can you instead use modules-refapp.openmrs.org? Admin password: sup3rS3cr3tPassw0rd

OK, I’ve done that! Actually there’s nothing new in my patient form, it’s just standard xform patient form

Second step, which address fields did you want to add? Can you lust list them here?

From Address Hierarchy, say State/Province and City/Village

Under “Form Fields” use those fields whose “Binding” property under the “Properties” tab, starts with “person_address_” For drop downs, change the field type to “Single Select” and then add the options via the “Add New Child” item from the menu that pops up after right clicking on the field.

ok, and what should I write in the binding property so that I can bind address hierarchy?

Do not change the binding. It already automatically saves in the database address fields.

so you mean that i should manually add all the options, like If it is city/village I have to add all the cities and villages that I have via the “Add New Child”? I just thought it’s going to be as easy as the integration of address hierarchy module to the registration app, like i’m just changing some configs of xforms so that it understands that it has to take all the cities from address_hierarchy_entry table in database

That’s just not so convenient if I have say 200 or more cities

Have you already configured the address hierarchy module with the necessary entries?

yes i have

Oh modules-refapp.openmrs.org?

Nope, I’m doing it in localhost, there’s no address hierarchy module in modules-refapp.openmrs.org so I thought it’s ok if i keep on doing it locally. Is it ok?

That would be fine if i could connect to your local instance. But since i cannot, i would like us walk through it using an instance that we can both connect to. I have just installed the module on the modules-refapp.openmrs.org server. Can you configure it as you have done locally?

Cool, i’ve just done that. What’s next?

I’ve changed country, city/village, address1 and address2. Changed their field types to Single Select and added a option to each of them

I’m ready to go on)