Skip to content

Allow managers to modify a registration despite form field requirements #5644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kewisch opened this issue Jan 30, 2023 · 6 comments · Fixed by #5682
Closed

Allow managers to modify a registration despite form field requirements #5644

kewisch opened this issue Jan 30, 2023 · 6 comments · Fixed by #5682

Comments

@kewisch
Copy link
Contributor

kewisch commented Jan 30, 2023

Is your feature request related to a problem? Please describe.
We have a set of internal events where the attendees are known from the start. We need to maintain a few fields internally on these attendees and would like to leverage Indico for that instead of yet another spreadsheet. Attendees are also expected to update a few fields (e.g. travel information)

So we've created a registration form with the fields, and have imported all attendees into the registrations. There are a few required fields. When emailing them for the first time, we just use {link} to let them know, and expect them to fill in all they know.

So now we've run into an issue:

  • As a registration manager, I have no way to modify the registration to flip those internal fields, or fill in partial information.
  • The form complains that the required fields are not filled out.

Describe the solution you'd like
I'd appreciate a toggle that would allow a registration manager, event organizer, or admin, to override the required fields. They would stay in a state that they are not filled out, but I can still change other registration fields.

Describe alternatives you've considered

  • Mark fields not required, make changes, mark them required again
  • Mark them as optional, then nag people to fill in the missing fields

Would something like that work out? It doesn't seem too complicated, but maybe I am missing some constraints.

@ThiefMaster
Copy link
Member

Huh, I could have sworn that this is already the case (implicitly, not w/ a checkbox)... but I must have been mixing this up with something else. Maybe the fact that we allow editing fields affecting the price for already-paid registrations when you are a manager.

Anyway, I think what you suggested makes perfect sense, and the implementation should indeed not be too hard - so if you want to send a PR, here are some suggestions that may result is less digging:

  • In the JS, you probably need to add new state to track the state of that checkbox (since it doesn't need to be sent to the server, no need to add it to the regular form data)
  • When this flag is enabled, do not set the required flag on fields nor add required-related validators to them
  • In RegistrationEditMixin you could check for management mode and in that case set partial=True instead of just marking optional field as partial - that way any field not send by the client won't be validated (even if it's otherwise required)

There may be some things I forget but those should be the main points.

PS: If it's just flags and no freetext/numeric data you need to attach to registrations, the "registration tags" feature might be useful instead...

@kewisch
Copy link
Contributor Author

kewisch commented Jan 30, 2023

Thank you for the tips, I'll look into that. I probably won't be as quick as with the other patch, we'll have to see how urgent this gets on our end.

Registration Tags are a good idea, and it would have worked mostly, but we also need to show participants the value of these internal form fields without allowing them to change it. We're doing that via the participant list right now, and it did not seem like I could add a column for a certain tag (and I expect that isn't how they should be used).

@kewisch
Copy link
Contributor Author

kewisch commented Feb 18, 2023

As noted in the PR, I've decided to leave out the checkbox and have this happen implicitly. This feels more natural and requires one less thing to click on.

However, I've now noticed that if you register a user as a manager, you run into the same issue where the fields are required. Out of consistency managers should probably be able to ignore setting the required fields here as well, but something tells me you might prefer an actual checkbox there. @ThiefMaster would you be ok also doing it implicitly in the register form, or would you prefer a checkbox here?

@ThiefMaster
Copy link
Member

ThiefMaster commented Feb 19, 2023

Hmm that's a good question. On one hand you can already use "add multiple users" which registers Indico users and only populates the general personal data fields. On the other hand when you go to the actual registration form as a manager you may simply forget to fill in a field, and thus being more explicit there would be useful...

FWIW the fancier option would be a "required fields are empty save anyway?" message between the form and the submit button that only shows up when the form is dirty (ie something changed) and required fields are missing. But I don't think the final-form lib exposes information whether fields are just invalid or if it's because a required field is missing (after all it's just a validation error in either case), so conditionally showing it may not work...

@kewisch
Copy link
Contributor Author

kewisch commented Feb 25, 2023

Correct me if I am wrong, but on the client side the only validation that exists is if it is a required field or not. The actual data validation occurs server side and is then passed back to the client.

So to show a fancy message, I could do:

  1. Inhibit the client side required validation (already happening with the patch as is)
  2. Send the data to the server and see if validation messages come back
  3. If in management mode, prompt the user required fields are not set, register anyway?
  4. If the user says yes: re-submit the form with an extra override param
  5. If the user says no: pass on the errors to the form so they will be flagged

I'm not how easy it will be to hook in and show the prompt. A more simple solution would be going back to a toggle checkbox, which I actually find reasonable for the create registration form. In this case we save steps 3-5, as we'd be sending the override parameter with the first form submission and the server can decide how to validate.

On the server side I've found a somewhat elegant solution to make required fields optional, while still validating the required personal data fields (first/last name, email). Extending this to look for an override parameter seems doable.

So in summary, I'd suggest:

  • In the create registration form:
    • Add a checkbox toggle to allow submitting despite missing required fields.
    • Client side validations skipped in management mode (aside from displaying the *)
    • Server side validates either all fields or only personal data fields, based on checkbox
  • In the modify registration form:
    • Don't add a checkbox toggle
    • Client side validations skipped in management mode (aside from displaying the *)
    • Server only validates personal data fields

@ThiefMaster
Copy link
Member

That sounds very reasonable.

The only part I meant that'd be super tricky if at all possible is doing the "show checkbox only when something is missing" part client-side. But you are right, if you send it to the server anyway, and use some kind of "force" flag when sending the request again (ie after the manager confirmed they really want to do this), then this should indeed be rather straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants