@comicrelief/component-library 7.9.0 → 7.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,9 +54,9 @@ var mpValidationSchemaCustom = mpValidationCustom.mpValidationSchema,
54
54
  mpValidationOptionsCustom = mpValidationCustom.mpValidationOptions;
55
55
 
56
56
  var MarketingPreferencesDSForm = function MarketingPreferencesDSForm() {
57
- function customSubmitHandler() {
57
+ function customSubmitHandler(formData) {
58
58
  // eslint-disable-next-line no-console
59
- console.log('Successful submission');
59
+ console.log('Successful submission', formData);
60
60
  } // For our default instance:
61
61
 
62
62
 
@@ -28,12 +28,15 @@ var CheckAnswer = function CheckAnswer(_ref) {
28
28
  if (e.target.checked) {
29
29
  newVal = e.target.value;
30
30
  } else {
31
- newVal = ''; // To ensure we're not letting invalid values get passed, reset any associated fields:
32
-
33
- var theseFields = _AssociatedFields.default[name].fieldNames;
34
- theseFields.forEach(function (fieldName) {
35
- setValue(fieldName, '');
36
- });
31
+ newVal = ''; // To ensure we're not letting invalid values get passed, reset any associated fields
32
+ // but only when it's not a hidden "passed values behind the scenes" field:
33
+
34
+ if (!mpValidationOptions[name].hideInput) {
35
+ var theseFields = _AssociatedFields.default[name].fieldNames;
36
+ theseFields.forEach(function (fieldName) {
37
+ setValue(fieldName, '');
38
+ });
39
+ }
37
40
  } // Update the checkbox field itself
38
41
 
39
42
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "7.9.0",
4
+ "version": "7.9.1",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -41,9 +41,9 @@ const {
41
41
  } = mpValidationCustom;
42
42
 
43
43
  const MarketingPreferencesDSForm = () => {
44
- function customSubmitHandler() {
44
+ function customSubmitHandler(formData) {
45
45
  // eslint-disable-next-line no-console
46
- console.log('Successful submission');
46
+ console.log('Successful submission', formData);
47
47
  }
48
48
 
49
49
  // For our default instance:
@@ -20,11 +20,14 @@ const CheckAnswer = ({
20
20
  } else {
21
21
  newVal = '';
22
22
 
23
- // To ensure we're not letting invalid values get passed, reset any associated fields:
24
- const theseFields = AssociatedFields[name].fieldNames;
25
- theseFields.forEach(fieldName => {
26
- setValue(fieldName, '');
27
- });
23
+ // To ensure we're not letting invalid values get passed, reset any associated fields
24
+ // but only when it's not a hidden "passed values behind the scenes" field:
25
+ if (!mpValidationOptions[name].hideInput) {
26
+ const theseFields = AssociatedFields[name].fieldNames;
27
+ theseFields.forEach(fieldName => {
28
+ setValue(fieldName, '');
29
+ });
30
+ }
28
31
  }
29
32
 
30
33
  // Update the checkbox field itself