diff --git a/src/Pages/Events/CreateEventFormQuestionBlock.js b/src/Pages/Events/CreateEventFormQuestionBlock.js index f890ae30b..808b27b63 100644 --- a/src/Pages/Events/CreateEventFormQuestionBlock.js +++ b/src/Pages/Events/CreateEventFormQuestionBlock.js @@ -78,7 +78,7 @@ export default function CreateEventFormQuestionBlock({ )} - {(question.type === 'multiple_choice' || question.type === 'dropdown') && ( + {(question.type === 'multiple_choice' || question.type === 'dropdown' || question.type === 'checkbox') && (
Answer options {(question.answer_options || []).map((option, optIndex) => ( diff --git a/src/Pages/Events/CreateEventPage.js b/src/Pages/Events/CreateEventPage.js index c130510c8..59ba96d48 100644 --- a/src/Pages/Events/CreateEventPage.js +++ b/src/Pages/Events/CreateEventPage.js @@ -58,7 +58,7 @@ function toApiRegistrationForm(questions) { base.answer_details = { max_chars: q.answer_details.max_chars }; } if ( - (q.type === 'multiple_choice' || q.type === 'dropdown') && + (q.type === 'multiple_choice' || q.type === 'dropdown' || q.type === 'checkbox') && q.answer_options && q.answer_options.length ) { @@ -126,7 +126,7 @@ export default function CreateEventPage() { if (newType === 'textbox') { return { ...base, answer_details: { max_chars: 200 } }; } - if (newType === 'multiple_choice' || newType === 'dropdown') { + if (newType === 'multiple_choice' || newType === 'dropdown' || newType === 'checkbox') { return { ...base, answer_options: ['Option 1', 'Option 2'] }; } return base; @@ -183,6 +183,9 @@ export default function CreateEventPage() { setSubmitError('Please select a minimum visible role for private events.'); return; } + if (maxAttendees !== UNLIMITED_ATTENDEES && (maxAttendees === '' || maxAttendees <= 0)) { + setSubmitError('Please enter a valid max attendees, or check "No limit".'); + } const payload = { id: eventId, @@ -332,18 +335,39 @@ export default function CreateEventPage() {
Max attendees
- - setMaxAttendees( - e.target.value ? parseInt(e.target.value, 10) : UNLIMITED_ATTENDEES, - ) - } - placeholder="No limit" - /> +
+ { + if (!e.target.value) { + setMaxAttendees(''); + return; + } + const val = parseInt(e.target.value, 10); + if (!isNaN(val)) setMaxAttendees(val); + }} + placeholder="e.g. 50" + /> + +