Skip to content

Fix event registration checkboxes, add API auth header, and add No Limit checkbox UI#2094

Merged
maernest04 merged 1 commit into
devfrom
ernest_ma/fixing_event_registration_max_attendees
Apr 24, 2026
Merged

Fix event registration checkboxes, add API auth header, and add No Limit checkbox UI#2094
maernest04 merged 1 commit into
devfrom
ernest_ma/fixing_event_registration_max_attendees

Conversation

@maernest04

Copy link
Copy Markdown
Collaborator

For issue #2093

Problem

  1. Broken Checkboxes: Registration checkboxes were not rendering because the form builder was stripping out the answer_options for checkbox-type questions before sending them to the API.
  2. Missing API Authorization: Creating events failed because the createSCEvent API call wasn't attaching the required JWT Authorization header.
  3. Unintuitive Max Attendees UI: The max attendees input relied on magic numbers (leaving it blank to send -1 for unlimited attendees), which was confusing and easily broken if users typed invalid inputs.

Solution

  1. Fixed Checkbox Persistence: Updated the form builder and API payload builder to properly preserve and edit answer_options for checkbox question types, exactly like we do for multiple choice and dropdowns.
  2. Added Auth Header: Updated the createSCEvent function to accept and attach the JWT token as a Bearer header, and passed the token from localStorage into the call.
  3. Added "No Limit" Checkbox: Replaced the max attendees magic number behavior with a dedicated "No limit" checkbox. If checked, it disables the number input and cleanly sends -1. If unchecked, frontend validation ensures the user enters a valid positive integer.

Files Changed

  • src/Pages/Events/CreateEventPage.js
    • Fixed toApiRegistrationForm and updateQuestionType to include checkbox types.
    • Added frontend validation for positive integer inputs on Max Attendees.
    • Replaced max attendees UI with a clean "No limit" checkbox alongside the number input.
    • Retrieved jwtToken from localStorage to pass to the API function.
  • src/Pages/Events/CreateEventFormQuestionBlock.js
    • Added checkbox to the condition that renders the editable answer options list so admins can define checkbox options.
  • src/APIFunctions/SCEvents.js
    • Modified createSCEvent to accept a token argument and insert it into the Authorization header.

@steeevin88 steeevin88 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rebase this lol, will approve after

@maernest04 maernest04 force-pushed the ernest_ma/fixing_event_registration_max_attendees branch from f530da2 to d81ee57 Compare April 24, 2026 07:19

@steeevin88 steeevin88 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool am trusting that you tested this

@codebyemily codebyemily left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codebyemily codebyemily left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@maernest04 maernest04 merged commit 40c02ed into dev Apr 24, 2026
4 checks passed
@maernest04 maernest04 deleted the ernest_ma/fixing_event_registration_max_attendees branch April 24, 2026 16:52
KhoaNguyen706 pushed a commit that referenced this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants