DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
389 stars 191 forks source link

TypeError: Cannot read property 'set' of undefined #112

Open bebaps opened 5 years ago

bebaps commented 5 years ago

This is a valid issue, but I am posting this more as a heads up for future users of this plugin. There have been many issues already logged for this error, with no real resolution. It seems the author of this plugin is no longer actively maintaining it, so be aware that you will need to pretty much fend for yourself with any issues with this plugin.

Screen Shot 2019-09-06 at 5 13 41 PM

When trying to use the setList method you might run into this issue:

Screen Shot 2019-09-06 at 4 53 49 PM

In any case, if you receive this error as many others have, you will need to check two main things:

  1. jQuery can actually find the element it is to set values for
  2. The elements that you are settings values for are "registered" with this plugin

I say "registered" because this plugin uses its own system to clone the inputs found in the DOM. This list can be found in jquery.input.js, but here's a pic:

Screen Shot 2019-09-06 at 4 54 31 PM

In my code, I had this tel input that was causing the error:

Screen Shot 2019-09-06 at 4 54 08 PM

After a few frustrating hours and basically dissecting this entire plugins source code (hence how I found out how this plugin "registers" the inputs that it will actually work with), I found that simply changing that input from a tel to a text solved the problem

Screen Shot 2019-09-06 at 4 54 15 PM

I hope this saves someone the time and frustration.

agengdp commented 4 years ago

I already frustating, before I found this issue. thank you for saving my life

orhangazi commented 4 years ago

Hey @bebaps, thanks for solution. You save my all day and painful head.

shain-digix commented 3 years ago

Hey @bebaps , thanks for the solution. You save my day as well.

flavioludi commented 2 years ago

Thank you, @bebaps :)

bisma-im commented 4 months ago

omg thanks, i would've never been able to find this on my own. you're a lifesaver!!