CiviCRM

On behalf of: state/province field lists all values, does not limit to those of the default country

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 4.0.8
  • Fix Version/s: 4.2
  • Component/s: None
  • Labels:
    None
  • Is MIH?:
    No
  • Code Sprint:
    No

Description

I've been testing with "on behalf of" for a Contribution form, but it probably affects all profiles: in a profile with state/country fields, when a default country is set, the state/province field lists all available values for all countries. I would expect that if, say, Canada is selected by default, then the list of state/provinces should be only those of Canada.

If I re-select the default country, it does an ajax refresh and it's OK.

I tried to fix it correctly (see attached patch), but when the form is submitted and has errors (in other fields), I have difficulties getting the value of the 'country' that was submitted so that I can generate a list of state/provinces for that country. More specifically, I don't know how to get the bltID for the 'onbehalf'.

As a lazy work-around, my patch limits the state/provinces if it's the initial form display, but if values were submitted, it lists all (since anyway, at that point, it's likely that the user selected a state/province).

Activity

Hide
Mathieu Lutfy added a comment -
Here is the patch.
Show
Mathieu Lutfy added a comment - Here is the patch.
Hide
Mathieu Lutfy added a comment -
08:17 < kurund> bgm: was checking http://issues.civicrm.org/jira/browse/CRM-9520, it is working for profiles..
08:17 < bgm> kurund: oh, ok, my specific bug was in "on behalf of" for donation forms
08:18 < kurund> bgm: yes.. so would it possible for you how it works for profile and implement the same way for on
                behalf ?
08:19 < kurund> bgm: check profile and provide another patch for on behalf :)
08:19 < bgm> kurund: any hints on where it's handled for profiles? i looked around, but didn't see it
08:19 < bgm> i.e. other than Core/BAO/UFGroup.php
08:21 < kurund> bgm: state select is rebuild if country is present .. check addStateCountryMap and fixAllStateSelects
08:21 < kurund> bgm: these 2 functions used to set / rebuild state select ..
Show
Mathieu Lutfy added a comment - 08:17 < kurund> bgm: was checking http://issues.civicrm.org/jira/browse/CRM-9520, it is working for profiles.. 08:17 < bgm> kurund: oh, ok, my specific bug was in "on behalf of" for donation forms 08:18 < kurund> bgm: yes.. so would it possible for you how it works for profile and implement the same way for on                 behalf ? 08:19 < kurund> bgm: check profile and provide another patch for on behalf :) 08:19 < bgm> kurund: any hints on where it's handled for profiles? i looked around, but didn't see it 08:19 < bgm> i.e. other than Core/BAO/UFGroup.php 08:21 < kurund> bgm: state select is rebuild if country is present .. check addStateCountryMap and fixAllStateSelects 08:21 < kurund> bgm: these 2 functions used to set / rebuild state select ..

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: