The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Copy value into lookup field in repeating section
I have a form that has a repeating section. In that section, I have places where I need to copy the values of lookup fields into dropdowns and it doesn't work like it does in non-repeating fields.
I have found something close here:http://community.formidableforms.com/help-desk/copy-text-from-one-field-to-another/ this was done by @<a class="topic_author" href="http://community.formidableforms.com/hire-a-pro/dev/vfontjr/">vfontjr</a>
I found this: https://formidableforms.com/knowledgebase/javascript-examples/#kb-repeating-sections but it only seems to copy from a field OUTSIDE the repeating section INTO a part in the repeating section.
This seems like it would be a very common thing to have to do, but I can't really find much on it.
To make it harder, I have 3 fields in the form that have copy.
So basically, what I am trying to do is this: https://formidableforms.com/knowledgebase/lookup/#kb-copy-value-to-a-lookup-field but INSIDE of a repeating section in 3 places.
Anyone come across this and/or have a solution?
February 19, 2018 at 12:33 pm
I am very close here. I am not a programmer but I have it just about working. If anyone out there can assist I think it would be something a lot of people would want to use:
The challenge: I get the copy function to work in each section, but it seems to have conflicts with the other repeating section, the first one. Seems I am not defining each repeating section on its own.
Here is a link to my form where you can see the fields, etc: http://manager.upper90mediagroup.com/testing-2/
<script>
jQuery(document).ready(function($) {
//* Below copies the State Tier Lookup to the State Tier and Regional Lookup for Price
$(document).on('change', '[id^=field_htkoa4-]', function() {
var sourceField = $('[id^=field_htkoa4-]').val();
$('[id^=field_o508v2-]').val(sourceField);
$('[id^=field_o508v2-]').trigger({
type: 'change',
originalEvent: 'custom'
});
});
//* Below copies the Choose Region to the State Tier and Regional Lookup for Price
$(document).on('change', '[id^=field_31m1l4-]', function() {
var sourceField = $('[id^=field_31m1l4-]').val();
$('[id^=field_o508v2-]').val(sourceField);
$('[id^=field_o508v2-]').trigger({
type: 'change',
originalEvent: 'custom'
});
});
//* Below copies the Count Checkboxes to Count Lookup for Table
$(document).on('change', '[id^=field_f7i9x4-]', function() {
var sourceField = $('[id^=field_f7i9x4-]').val();
$('[id^=field_b72xh4-]').val(sourceField);
$('[id^=field_b72xh4-]').trigger({
type: 'change',
originalEvent: 'custom'
});
});
//* Below copies the Count Lookup with X to the Count Loookup for Price Calculation
$(document).on('change', '[id^=field_rpnou4-]', function() {
var sourceField = $('[id^=field_rpnou4-]').val();
$('[id^=field_tatct4-]').val(sourceField);
$('[id^=field_tatct4-]').trigger({
type: 'change',
originalEvent: 'custom'
});
});
});
</script>
February 26, 2018 at 6:42 pm
If anyone has any ideas or can help I would appreciate it, thanks in advance.
March 8, 2018 at 7:35 am
I was able to modify this example http://community.formidableforms.com/help-desk/copy-text-from-one-field-to-another/
Just in case anyone else runs into this, here was my solution:
<script>
jQuery(document).ready(function($) {
//* Below copies the State Tier Lookup to the State Tier and Regional Lookup for Price
$(document).on('change', '[id^=field_htkoa4-]', function() {
var sourceField = $(this).val();
var barcodeid = $(this).attr("id");
var index_number = barcodeid.substr(barcodeid.lastIndexOf("-")+1);
var destination_field = "#field_o508v2-" + index_number;
$(destination_field).val(sourceField); //destination field key
$(destination_field).trigger({ type:'change', originalEvent:'custom' }); // trigger a change event in Lookup
});
//* Below copies the Choose Region to the State Tier and Regional Lookup for Price
$(document).on('change', '[id^=field_31m1l4-]', function() {
var sourceField = $(this).val();
var barcodeid = $(this).attr("id");
var index_number = barcodeid.substr(barcodeid.lastIndexOf("-")+1);
var destination_field = "#field_o508v2-" + index_number;
$(destination_field).val(sourceField); //destination field key
$(destination_field).trigger({ type:'change', originalEvent:'custom' }); // trigger a change event in Lookup
});
//* Below copies the Count Checkboxes to Count Lookup for Table
$(document).on('change', '[id^=field_f7i9x4-]', function() {
var sourceField = $(this).val();
var barcodeid = $(this).attr("id");
var index_number = barcodeid.substr(barcodeid.lastIndexOf("-")+1);
var destination_field = "#field_b72xh4-" + index_number;
$(destination_field).val(sourceField); //destination field key
$(destination_field).trigger({ type:'change', originalEvent:'custom' }); // trigger a change event in Lookup
});
//* Below copies the Count Lookup with X to the Count Loookup for Price Calculation
$(document).on('change', '[id^=field_rpnou4-]', function() {
var sourceField = $(this).val();
var barcodeid = $(this).attr("id");
var index_number = barcodeid.substr(barcodeid.lastIndexOf("-")+1);
var destination_field = "#field_tatct4-" + index_number;
$(destination_field).val(sourceField); //destination field key
$(destination_field).trigger({ type:'change', originalEvent:'custom' }); // trigger a change event in Lookup
});
});
</script>
Discussion closed.