+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
})
// This is just a cheap trick to store the name when the form reloads
.on('change', function() {
- $('[name=pcp_made_through]', $form).val($(this).select2('data').text || '');
+ var fieldNameVal = $(this).select2('data');
+ if (!fieldNameVal) {
+ fieldNameVal = '';
+ }
+ $('[name=pcp_made_through]', $form).val(fieldNameVal.text);
});
});
</script>