Drupal Logo

Overriding Drupal 6 Automatic Select Element Validation

29th March 2011 - 9 minutes read time

Whilst creating a large and complex form in Drupal 6 recently I hit upon a problem that took me a couple of hours to solve so I am posting the solution here in case anyone else gets similarly stuck. I am also writing this down so that I can remember the strategy in case I have to do the same thing again.

What I was doing was creating an event booking form. The form allowed users to select from a number of times slots in a select list, but each time had a limited number of bookings. When the user submitted the form and all allocated slots for their selected time were fully booked they were shown a message asking them to select a different time slot. The original time was removed from the select list so that the user didn't try to select it again. This was fine and it all worked as expected but when this happened I also got the following error message from Drupal.

MySQL Logo

Finding Duplicate Values In A MySQL Table

6th February 2008 - 2 minutes read time

To find duplicate values you need to use the MySQL COUNT() function and then pick out all of the counts that are greater than one.