Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Formidable Form Copying Repeater Sections Values to Another Repeater Section Fields. WordPress

  • SOLVED

1. I have 22 Sections in a form. Section 3, 4 are repeater field. Also section 8 and 9 are repeater field.
So, what I need is basically copying a certain field text from section 3 to section 8 and from section 4 to section 9.

So, if a user add additional rows in section 3,4 the new code should automatically populate equal number of rows in section 8 and 9.

See Attached image for details.

On section 17 I need to copy names and add equal number of rows from section 3, 4.

Section 21 I need to copy names, address etc from repeater section 4 and also create empty serial with numbers 1 2 3 etc for signature.

Form link: http://wpunmarked.com/new-deed/

Answers (3)

2018-04-19

Reigel Gallarde answers:

First, when working on javascript, always check for errors on the console. Any error might give you problem with other js code. As much as possible, remove or fix all error first.

I can't give you code because your page has javascript error, I can't test some code.

But what you need to do is to get the click event on the add button and with that you can trigger click event on the other corresponding add button

Example:
You should catch the click event on section 3.
With this, you then trigger the click event on "add" button on section 8.

2018-04-19

Mohamed Ahmed answers:

It's easy to create the code but really you have a JS code issue and it must be fixed
that will help me to work.

2- But I want to know to confirm, Is this what you want?
1-If user clicks to duplicate the section 3 or 4 need to duplicate the text fields only to 8 or 9.
2-Need to copy names from section 3 to section 17 and also, duplicate the text fields from section 3
3-copy names, address and all fields from repeater section 4 to section 21
what is this mean? >> create empty serial with numbers 1 2 3 etc for signature?

Regards


Jihan Ahmed comments:

JS Error fixed.

Let me simply.
1. First of all we need to add equal number of rows in section 3 and 8 also on 4 and 9.
So if you click on Add Row on section 3 it should trigger on section 8 also. If you add 5 rows on section 3 it should add 5 rows on section 8 automatically. I understand this can be done using something like this

jQuery("[id^='frm_section_135-']").find('a.frm_add_form_row.frm_button').last().on('click', function(){
jQuery("[id^='frm_section_164-']").find('a.frm_add_form_row.frm_button').last().click();
})

2. Now come to copying values... Lets say the Name field on section has the id "field_qkj0m-0" it will become field_qkj0m-1, field_qkj0m-2, field_qkj0m-3 as you continue adding rows.

Now Accomplishing the equal rows on section 8 the Name field id is "field_4c3yh-0" it will be field_4c3yh-1, field_4c3yh-2, field_4c3yh-3 similarly.
So, here we write a js/php to copy field values from field_qkj0m-0 to field_4c3yh-0, field_qkj0m-1 to field_4c3yh-1 etc.
Plz note this ID's are auto generated when you add rows you can inspect on the form.

Here I think this is very similar code

$(document).on('keyup', '.CopyBarcode', function(){
"use strict"
$("[id^=field_o8v4sw-]").on("change", function() { //source field key
var sourceField = $(this).val(),
barcodeid = $(this).attr("id"),
index_number = barcodeid.substr(barcodeid.lastIndexOf("-")+1),
destination_field = "#field_6qubt-" + index_number;
$(destination_field).val(sourceField); //destination field key
$(destination_field).trigger({ type:'change', originalEvent:'custom' }); // trigger a change event in Lookup field so “watching” fields can update
});
});

https://community.formidableforms.com/help-desk/copy-text-from-one-field-to-another/

The rest section are same just coping fields values from section 3, 4 to other fields. I think if we can accomplish the above code this is similar.

Can you plz implement the code. I can provide ftp and admin access. Thanks !


Jihan Ahmed comments:

I can not PM you. Can you leave me your email address plz. Thanks !


Jihan Ahmed comments:

This code also might be of help https://formidableforms.com/knowledgebase/javascript-examples/#kb-repeating-sections

Thanks !


Mohamed Ahmed comments:

Ok this is my email
[email protected]


Jihan Ahmed comments:

Plz check your email.

2018-04-18

Kyle answers:

Your link doesn't work


Jihan Ahmed comments:

Plz try now was set to under constrictor mode.