diff --git a/assets/javascripts/discourse/models/custom-wizard.js.es6 b/assets/javascripts/discourse/models/custom-wizard.js.es6
index 0c4a9107..cbc7325e 100644
--- a/assets/javascripts/discourse/models/custom-wizard.js.es6
+++ b/assets/javascripts/discourse/models/custom-wizard.js.es6
@@ -86,6 +86,12 @@ const CustomWizard = Discourse.Model.extend({
error = 'id_required';
return;
}
+
+ if (!f.type) {
+ error = 'type_required';
+ return;
+ }
+
f.set('id', id.underscore());
if (f.label === '') delete f.label;
@@ -97,6 +103,8 @@ const CustomWizard = Discourse.Model.extend({
error = 'field.need_choices';
return;
}
+
+ if (f.dropdown_none === '') delete f.dropdown_none;
}
delete f.isNew;
diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
index 38a23f26..b00452c3 100644
--- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
+++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
@@ -39,7 +39,7 @@
{{i18n 'admin.wizard.type'}}
- {{combo-box value=field.type content=types}}
+ {{combo-box value=field.type content=types none="admin.wizard.field.type"}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 5b08f7f1..ab44cd57 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -50,6 +50,7 @@ en:
name_required: "Wizards must have a name."
steps_required: "Wizards must have at least one step."
id_required: "All wizards, steps, fields and actions need an id."
+ type_required: "All fields need a type."
after_time_need_time: "After time is enabled but no time is set."
after_time_invalid: "After time is invalid."
field:
@@ -62,6 +63,7 @@ en:
banner_placeholder: "Image url"
description: "Description"
field:
+ type: "Choose a type"
header: "Fields"
label: "Label"
description: "Description"
diff --git a/controllers/admin.rb b/controllers/admin.rb
index 57f679b3..df3d690c 100644
--- a/controllers/admin.rb
+++ b/controllers/admin.rb
@@ -53,6 +53,11 @@ class CustomWizard::AdminController < ::ApplicationController
break
end
+ if f["type"].blank?
+ error = 'type_required'
+ break
+ end
+
if f["type"] === 'dropdown'
choices = f["choices"]
if (!choices || choices.length < 1) && !f["choices_key"] && !f["choices_preset"]