Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created April 29, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/a98c0d94002a75d3f923479f303bf672 to your computer and use it in GitHub Desktop.
Save vfontjr/a98c0d94002a75d3f923479f303bf672 to your computer and use it in GitHub Desktop.
jQuery(document).ready(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
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment