fix year in headers
[civicrm-core.git] / templates / CRM / Contribute / Form / PCP.js.tpl
index 5d81d64dffb2ab551eac5cc25c917a804817fa4d..1b137b5441aa81f1e97e413e2b8f5e53161c34cc 100644 (file)
@@ -2,7 +2,7 @@
  +--------------------------------------------------------------------+
  | 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>