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
Script in an embedded form
Hi,
I've a form in which I placed a script that duplicates the contents of a field in another field. Since this form is embedded in a parent form, I adapted the script and modified the field names (item_meta). For that, I added the section ID I got by inspecting the web page. Wishing to integrate the form with other parent forms, the section ID will change. Is it possible to add code to automatically detect the section ID?
The script is below with [1150] as Section ID:
<script type="text/javascript">
jQuery(document).ready(function($){
var sourceField = $("[name='item_meta[1150][0][1121]']").val();
$("[name='item_meta[1150][0][1130]']").val(sourceField);
$("[name='item_meta[1150][0][1130]']").trigger({ type:'change', originalEvent:'custom' });
$("[name='item_meta[1150][0][1121]']").change(function(){
var sourceField = $("[name='item_meta[1150][0][1121]']").val();
$("[name='item_meta[1150][0][1130]']").val(sourceField); //START field key
$("[name='item_meta[1150][0][1130]']").trigger({ type:'change', originalEvent:'custom' });
});
});
</script>
Thank you.
March 7, 2018 at 9:42 am
My solution is:
Discussion closed.