1. Home
  2. Docs
  3. Troubleshooting
  4. Fields are not working correctly inside repeater

Fields are not working correctly inside repeater

Third party plugins can introduce new fields for Contact Form 7, like datepickers, google maps, postal code selectors, signature fields, …

Often times, a field like this depend on some kind of JavaScript init() function. It is important that this function is called after the field is rendered.

Now, when a field like this is inside a repeater, it gets created on the fly. Each time this happens, the init() function will need to be called again, and make sure the field works properly.

This can be achieved with some code like this:

jQuery('form').on('wpcf7cf_repeater_added', function(e) {
  // call init() function here.
});

Of course, not all developers name their init-functions “init()“. It can have any name they choose. Or there might be more than on function you need to call in order to correctly initialize the fields. In some cases it could even be impossible to use the field inside a repeaters. For example because the developer intended the field to be used only once per form, or because they simply did not take into account the possibility that their field would ever be used inside a repeater, and so there is simply no init() function available.

It’s always a good idea to read up on the documentation of the field you want to use, to check if there is an init function. If there seems to be none, you could try to get in touch with the author and see if they can add a function to initialize their field.

Some examples of these requests:

Was this article helpful to you? Yes No