After the last update I noticed this problem popping up while trying to edit a select/dropdown from my WordPress admin.
The problem:
In the WordPress admin, while editing a form, clicking on the "Edit" link for a select field which contains numeric option values was throwing this error:
Object 43 has no method "replace"
As a result, the edit options do not appear and the element cannot be edited.
Expected behavior:
Clicking on "edit" for the dropdown should have opened the dropdown's customization options. Clicking "edit" should not have generated any JS errors.
Detail:
The dropdown contained a list of options with numeric values and separate text. The first option contained a value with the integer "43", and the JS was assuming ( by virtue of calling value.replace()
) that the "value" variable would be a string. This causes an error because the .replace() method only exists for strings, not for integers.
Solution:
The problem file is js.php
in the GetFieldChoices()
function. I was able to solve the error for now by adding value = value.toString();
at around line 869, after the value variable is defined.