Closed field-adder breaks if it contains tokeninput

digitalpoint

Well-known member
Licensed customer
Affected version
2.2.13
You end up with:
Uncaught TypeError: Cannot read properties of undefined (reading 'replace')

It's because the hidden input fields that select2 use don't have names.

I didn't test it too much, but perhaps it would be more appropriate for the .find selectors inside XF.FieldAdder.create() to be .find('input[name*="{counter}"], select[name*="{counter}"], textarea[name*="{counter}"]') rather than .find('input, select, textarea')?

Or check if there is a name attribute before assuming there is and blindly doing a name.replace()?
 
FWIW, this was what I was doing when I ran into it. A RSS monitoring system that alerts certain user(s) when something new comes through.

1695680732439.webp

Since tokeninput doesn't work, I just ended up doing it as a normal (boring) text field and comma separating the usernames.
 
Automated triage: Not a bug

Thank you for reporting this issue. This report is stale. In 2.3 the field adder was rewritten and the token input now uses a different library, so the error described here can no longer happen. If you still see a problem with token inputs inside a field adder on the current version, please open a new report with reproduction steps.

This is an automated assessment. A member of staff may review and update it.
 
Back
Top Bottom