Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5
-
Fix Version/s: 4.5
-
Component/s: CiviCRM Profile, CiviHR
-
Labels:None
Description
When using a profile form with a multi-value custom-data group, there is an editable popup for the custom-fields. If exactly one of the fields a is a Country field, AND exactly one is a State/Province field, then the two should be linked via Javascript – so that when user chooses the "Country", then the "States" field is updated with a filtered listing. (For example, the country/state fields in CiviHR's "Identification" screen should be linked.)
This logic is currently implemented in profile edit forms for the core Country and State/Province address fields. Please investigate re-using / extending the existing code in CRM_Core_BAO_Address::addStateCountryMap and CRM/common/stateCountry.tpl so it applies to custom fields in a profile.
Although the key requirement is to handle this in a multi-value custom-data group edit pop-up - ideally, this would be implemented so that it applies to Country/State custom field pairs in a profile form regardless of whether this is a multi-value custom data set pop-up form or a simple profile form AS LONG AS both fields in the pair belong to the same custom data set.
[Fallback:If you can't find a clear way to do this, then check with Yashodha or Tim about a CiviHR-specific implementation.]
— Testing —
This would be a good candidate for a web-test. One major issue in creating the web-test will be the fixture – i.e. we'll need to setup a few custom-data fields and a profile form.You could use XML to create these, e.g.
1. Manually create custom-data and profile on a local site
2. Export to XML with "civix generate:custom-xml --data=XX --uf=XX.
3. In the test case, use
$import = new CRM_Utils_Migrate_Import();
$import->run(_DIR_ . 'relative/path/to/xml');