We're working on a french postal codes extension based on the Belgian one. We want to use the API provided by the National French Mail Company.
According to the Select2 doc for Ajax (remote request), we should use the <select>
markup but it doesn't work, even though following this post, it should.
We can see this error in the console Uncaught Error: Option 'ajax' is not allowed for Select2 when attached to a <select> element.
If we use the <input>
markup instead, we can get data in the console but it also fails and we have this error: Uncaught TypeError: Cannot read properties of undefined (reading 'toUpperCase')
meaning that we need to transform the current result into the proper format using processResults(data) as described in the Select2 documentation.
We are using CiviCRM 5.43 on WP 5.82 and the standard Select2 library is 3.5.4. Forcing to Select2 version 4 causes a crash.
Any idea on how to overcome this issue?