Skip to main content

Activity

commented on Limit the number of tickets a user can purchase
Andrew McLean offered this solution to the problem:


I’ll answer my own question. If you want to limit people to selecting a single ticket, then it’s probably better to use a checkbox as the input element.
For my application I wanted to have multiple ticket types, but only let the user choose one, I did that by adding a bit of JavaScript to the onclick attribute of the input tag. The way the code works is that if you click on the checkbox, any other inputs of class “ticket” are unchecked.

<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level3” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £10.00 Saturday and Sunday (Full Price)</strong></div>

<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level2” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £5.00 Sunday Only (Full Price)</strong></div>

<div><strong><input type=“checkbox” class=“ticket” name=“event_ticket_level1” value=“1” onclick=“$(‘input.ticket’).not(this).prop(‘checked’, false)”> £5.00 Saturday Only (Full Price)</strong></div>


Thanks for sharing, Andrew.
posted 2018-10-04 02:32:45 -0700
responded to Liquid request. Variables with completed
posted 2018-09-11 00:50:53 -0700
responded to Are tag fields merged when merging two profiles using "potential duplicates" option? with completed
posted 2018-09-07 02:53:09 -0700
responded to Is there an option to mass update from an old point person to a new point person? with completed
posted 2018-09-06 02:34:07 -0700
responded to List membership status in email blast with completed
posted 2018-08-28 03:08:22 -0700
responded to what is a moneybomb page with completed
posted 2018-08-27 02:59:59 -0700
responded to API imports result call returns an empty failure_csv field. with completed
posted 2018-08-14 04:49:01 -0700
responded to Old donation export tool not working with considering
posted 2018-07-19 04:41:42 -0700
responded to How do I edit the color of the next arrows in the featured content sliders? with completed
posted 2018-07-06 05:01:18 -0700
responded to How do I edit thank you for signing up and unfollow messages displayed on screen? with incomplete
posted 2018-09-12 16:17:57 -0700
responded to Donation V2 Pages Not Currently Supported on V1 Themes with completed
posted 2018-06-27 13:29:10 -0700