Browse Source

Remove "Don't know" options from templates

Alan Lam 5 years ago
parent
commit
8ebc736d93
3 changed files with 48 additions and 32 deletions
  1. 8 0
      engine/form.php
  2. 19 15
      json/age_verification.json
  3. 21 17
      json/age_verification_mitchells_and_butlers.json

+ 8 - 0
engine/form.php

@@ -253,7 +253,11 @@ class Form {
 	 */
 	private static function renderSelectField(object $options): void {
 		$id = str_replace("_", "-", $options->name);
+		$default_value = $options->defaultValue ?? null;
+
 		$selected_value = $options->value ?? http::value($options->name);
+		if($selected_value === null) $selected_value = $default_value;
+
 		$required = ($options->required ?? false) ? "required" : "";
 		$help_text = $options->helpText ?? false;
 
@@ -368,7 +372,11 @@ class Form {
 	 */
 	private static function renderRadioField(object $options): void {
 		$id = str_replace("_", "-", $options->name);
+		$default_value = $options->defaultValue ?? null;
+
 		$current_value = $options->value ?? http::value($options->name);
+		if($current_value === null) $current_value = $default_value;
+
 		$required = ($options->required ?? false) ? "required" : "";
 		$help_text = $options->helpText ?? false;
 		$inline = ($options->type === "inline-radio") ? "custom-control-inline" : "";

+ 19 - 15
json/age_verification.json

@@ -58,9 +58,10 @@
 			"name": "door_sensor_alert",
 			"label": "Door Sensor Alert",
 			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"],
+			"displayStrings": ["Did not notice", "No", "Yes"],
 			"helpText": "Was there a sound or visual alert when you entered the venue?",
-			"customerExport": false
+			"customerExport": false,
+			"defaultValue": "1"
 		},
 
 		{
@@ -144,7 +145,7 @@
 			"name": "challenger_gender",
 			"label": "Gender",
 			"values": ["", "M", "F"],
-			"displayStrings": ["No challenge/Don't know", "Male", "Female"],
+			"displayStrings": ["No challenge", "Male", "Female"],
 			"customerExport": false
 		},
 		{
@@ -152,7 +153,7 @@
 			"name": "challenger_eye_contact",
 			"label": "Eye Contact",
 			"values": ["", "0", "1"],
-			"displayStrings": ["No challenge/Don't know", "No", "Yes"],
+			"displayStrings": ["No challenge", "No", "Yes"],
 			"customerExport": false
 		},
 
@@ -176,7 +177,7 @@
 			"name": "play_jackpot",
 			"label": "Jackpot Value",
 			"values": ["", 5, 10, 15, 20, 25, 35, 50, 100, 500],
-			"displayStrings": ["Did not play/Don't know", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
+			"displayStrings": ["Did not play", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
 			"customerExport": false
 		},
 		{
@@ -184,7 +185,7 @@
 			"name": "play_machine_stake",
 			"label": "Stake Played",
 			"values": ["", 0.1, 0.2, 0.25, 0.3, 0.5, 1, 2],
-			"displayStrings": ["Did not play/Don't know", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
+			"displayStrings": ["Did not play", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
 			"helpText": "This is how much the machine charges you per spin."
 		},
 		{
@@ -192,7 +193,7 @@
 			"name": "play_minutes",
 			"label": "Time Played (Minutes)",
 			"values": ["", "1", "2", "3", "4", "5"],
-			"displayStrings": ["Did not play/Don't know", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
+			"displayStrings": ["Did not play", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
 		},
 		{
 			"type": "number",
@@ -218,29 +219,32 @@
 			"type": "inline-radio",
 			"name": "citizen_card_brochure_displayed",
 			"label": "Citizen Card Brochure Displayed",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_25",
 			"label": "Think 21 or Think 25",
-			"values": ["", "Think 21", "Think 25"],
-			"displayStrings": ["Don't know", "Think 21", "Think 25"]
+			"values": ["Think 21", "Think 25"],
+			"displayStrings": ["Think 21", "Think 25"]
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_badge",
 			"label": "Think 21/25 Badge Worn by Staff",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_poster",
 			"label": "Think 21/25 Poster Displayed",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "textarea",

+ 21 - 17
json/age_verification_mitchells_and_butlers.json

@@ -58,9 +58,10 @@
 			"name": "door_sensor_alert",
 			"label": "Door Sensor Alert",
 			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"],
+			"displayStrings": ["Did not notice", "No", "Yes"],
 			"helpText": "Was there a sound or visual alert when you entered the venue?",
-			"customerExport": false
+			"customerExport": false,
+			"defaultValue": "1"
 		},
 
 		{
@@ -144,7 +145,7 @@
 			"name": "challenger_gender",
 			"label": "Gender",
 			"values": ["", "M", "F"],
-			"displayStrings": ["No challenge/Don't know", "Male", "Female"],
+			"displayStrings": ["No challenge", "Male", "Female"],
 			"customerExport": false
 		},
 		{
@@ -152,7 +153,7 @@
 			"name": "challenger_eye_contact",
 			"label": "Eye Contact",
 			"values": ["", "0", "1"],
-			"displayStrings": ["No challenge/Don't know", "No", "Yes"],
+			"displayStrings": ["No challenge", "No", "Yes"],
 			"customerExport": false
 		},
 
@@ -230,8 +231,8 @@
 			"type": "inline-radio",
 			"name": "play_machine_line_of_sight",
 			"label": "Machine Line of Sight of Bar",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"],
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
 			"helpText": "Was the machine in line of sight of the bar?"
 		},
 		{
@@ -239,7 +240,7 @@
 			"name": "play_jackpot",
 			"label": "Jackpot Value",
 			"values": ["", 5, 10, 15, 20, 25, 35, 50, 100, 500],
-			"displayStrings": ["Did not play/Don't know", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
+			"displayStrings": ["Did not play", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
 			"customerExport": false
 		},
 		{
@@ -247,7 +248,7 @@
 			"name": "play_machine_stake",
 			"label": "Stake Played",
 			"values": ["", 0.1, 0.2, 0.25, 0.3, 0.5, 1, 2],
-			"displayStrings": ["Did not play/Don't know", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
+			"displayStrings": ["Did not play", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
 			"helpText": "This is how much the machine charges you per spin."
 		},
 		{
@@ -255,7 +256,7 @@
 			"name": "play_minutes",
 			"label": "Time Played (Minutes)",
 			"values": ["", "1", "2", "3", "4", "5"],
-			"displayStrings": ["Did not play/Don't know", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
+			"displayStrings": ["Did not play", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
 		},
 		{
 			"type": "number",
@@ -281,29 +282,32 @@
 			"type": "inline-radio",
 			"name": "citizen_card_brochure_displayed",
 			"label": "Citizen Card Brochure Displayed",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_25",
 			"label": "Think 21 or Think 25",
-			"values": ["", "Think 21", "Think 25"],
-			"displayStrings": ["Don't know", "Think 21", "Think 25"]
+			"values": ["Think 21", "Think 25"],
+			"displayStrings": ["Think 21", "Think 25"]
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_badge",
 			"label": "Think 21/25 Badge Worn by Staff",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_poster",
 			"label": "Think 21/25 Poster Displayed",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Don't know", "No", "Yes"]
+			"values": ["0", "1"],
+			"displayStrings": ["No", "Yes"],
+			"defaultValue": "1"
 		},
 		{
 			"type": "textarea",