The Problem
A user asked the following question on the FormidableForms Community Forum:
I have a form in which I used the following script to copy text from one text field to another (lookup text field). It worked until now. But now that I have moved these two fields into a repeatable section, the script has stopped working.
The Solution
When you added the fields to the repeatable section, the field ID changed.
The first field on form is field_o8v4sw-0. When you add a row to a repeatable section, the field ids will incremented. So, if you 9 more rows, the field ids will be:
field_o8v4sw-0
field_o8v4sw-1
field_o8v4sw-2
field_o8v4sw-3
field_o8v4sw-4
field_o8v4sw-5
field_o8v4sw-6
field_o8v4sw-7
field_o8v4sw-8
field_o8v4sw-9
Counting always starts at 0. Instead of checking for each individual field to change, this can be done with a wild card.
var sourceField = $(this).val(); //source field key
In order to determine the destination field, you're going to have to do some string manipulation. So the first thing we have to do is get the actual ID of the target field.
Next, we need to get the number at the end of the ID. This number will be the same as the destination field.
Now we can populate the destination field.
$(destination_field).val(sourceField);
Here is your new jQuery:
Successful websites continuously attract the right type of visitors and lead them down a path toward becoming a customer. This requires consistent content publishing and monitoring of the website to make sure it is achieving its objectives. It also necessitates routine upkeep to assure that your website operates at peak performance and maximum efficiency.



