To replicate -
Enable address field for a contact along with country and state.
The country and state field is added correctly but the ajax load of fetching the state is not working.(See attached screenshot)
This is because hook_menu is not present in d8 and there is no routing created in webform civi to fetch the state options and load it on the field.
Also, there is a number of reference in webform_civicrm_forms.js which still expects some old deprecated params to be set-
- form class is replaced by "webform-submission-form" instead of "webform-client-form"
- '.webform-client-form-'+nid - There is no nid set for webforms in d8 so not sure if it will ever get populated?
- webformProp used in this file is removed from d8 webform.
- webform-civicrm/js/% is not yet implemented in this module yet.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screen Shot 2019-09-21 at 9.17.51 AM.png | 299.93 KB | karing |
| Screenshot 2019-05-03 10.33.34.png | 26.2 KB | jitendrapurohit |
Comments
Comment #2
mglamanYeah, there is a lot of legacy stuff in there. We'll need to break down and identify each task that needs to be completed.
This is a slight passthru to return the following values
It feels like this could better leverage Drupal's Form APIs versus bespoke AJAX and JavaScript handling.
Comment #3
dsnopek+1 to Form API
Comment #4
davej commentedI tested on the latest 8.x-5.x-dev release, dated 6th September.
The states loaded correctly, hooray! However when submitting, there was a form validation error. I selected country United Kingdom and state Bristol, city of. The error was:
Mismatch: "BST" is not a state/province of United States. Please enter a valid state/province abbreviation for State/Province.
This occurred regardless of whether United Kingdom was set in Civi as the default country.
Comment #5
karingComment #6
karingHi Dave! This is working -> (see screenshot) ->
In CiviCRM:
I have enabled 3 countries in CiviCRM -> civicrm/admin/setting/localization?reset=1
Canada, Netherlands, United States (under Available Countries as well as under Available States and Provinces.
Canada is set to Default Country
On the Webform:
I can select any of these three countries on the webform and the states/province select is properly repopulated and Submit works fine.
Here's the YAML that goes with the screenshot I posted.
Comment #7
karing