Skip to content

Commit

Permalink
Merge pull request #4199 from magfest/form_fixes
Browse files Browse the repository at this point in the history
Fixing form validation bugs
  • Loading branch information
bitbyt3r authored Aug 4, 2023
2 parents 7d2689d + dbfd436 commit 50eaf1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions uber/forms/attendee.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ def get_non_admin_locked_fields(self, attendee):
def validate_shirt(form, field):
if (form.amount_extra.data > 0 or form.badge_type.data in c.BADGE_TYPE_PRICES) and field.data == c.NO_SHIRT:
raise ValidationError("Please select a shirt size.")

def get_optional_fields(self, attendee, is_admin=False):
optional_list = super().get_optional_fields(attendee)

if attendee.badge_type not in c.PREASSIGNED_BADGE_TYPES:
optional_list.append('badge_printed_name')

return optional_list


class OtherInfo(MagForm):
Expand Down
2 changes: 1 addition & 1 deletion uber/site_sections/preregistration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ def validate_dealer(self, session, form_list=[], **params):

@ajax
def validate_attendee(self, session, form_list=[], **params):
id = params.get('id', params.get('edit_id'))
id = params.get('id', params.get('edit_id', params.get('attendee_id')))
if id in [None, '', 'None']:
attendee = Attendee()
else:
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/preregistration/stripeForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
{% else %}
var collectStripePayment = function (client_secret, stripe_id, success_url, cancel_url) {
var stripeModal = bootstrap.Modal.getOrCreateInstance($('#stripeModal'));
sripeModal.show();
stripeModal.show();
$("#cc-message-alert").hide().removeClass().addClass("alert").children("span").html("");
var form = document.getElementById('payment-form');
var stripe = Stripe('{{ c.STRIPE_PUBLIC_KEY }}');
Expand Down

0 comments on commit 50eaf1e

Please sign in to comment.