There is an issue with the latest 3.0.4 branch that was caused by this commit.
https://github.com/jshjohnson/Choices/commit/394bde313d0f8a50b4c2b9d64d35b76ded68a515
The issue is that when I have select items that are objects, this fails with the following error.
Uncaught TypeError: e.replace is not a function
at t.stripHTML (formio.full.js:16252)
at Object.addItemText (formio.full.js:16250)
at e.value (formio.full.js:16250)
at e.value (formio.full.js:16250)
at e.value (formio.full.js:16250)
It seems pretty clear that this was written for the select options that are strings, but did not take into account the select options that are objects where replace is not a function.
Here is a JSFiddle with the issue.
I think a cleaner solution would be to just cast value to a string within getWidthOfInput before running stripHTML. Then replace will always be defined.
I added a comment to the pull request that I would appreciate you reading and providing your input. One thing that I remembered when configuring this element is that you do allow for a "label" and a "value". Why are we not determining the width based on the "label" and not the "value". Maybe that would be cleaner since in every case the "label" will always be a string. That is something that is consistent no matter the type of value.
getWidthOfInput is called when you are inputting data into the input field - this wouldn't be a label, it would be the actual value of the input 馃憤
While waiting for an update for this package, you can add a dirty hotfix to your project.
Add a prototype function for Number and Object types.
Number.prototype.replace = function() {
return this;
};
Object.prototype.replace = function() {
return this;
};
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hopefully, this issue can be resolved soon...
This has been fixed in version 6.0.2
Most helpful comment
Hopefully, this issue can be resolved soon...