Limiting number of selections in a combo box or checkbox question
Last Post 04-08-2010 07:14 AM by David To. 4 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
THSUser is Offline
going with the flow
going with the flow
Posts:48
Avatar

--
04-07-2010 07:06 AM

    Is there any way to limit the number of selections that can be made in a checkbox or checkbox group other than just one or multiple? Here's my dilema:

    This is an event registration form where a registrant can select to purchase 1, 2, 3 or 4 optional workshops. There are a total of 16 to choose from where four workshops are running concurrently on any given day/time (four workshops on monday morning, four workshops on monday afternoon, etc). So, the idea is to prevent a registrant from selecting two workshops that occur at the same time. This is simple for those selecting one or four workshops since that can be handled with specific grouping of radio button questions, but if they do two or three, there's no way to group the workshops using the radio button option that would always prevent selecting one or more sessions that occur at the same time. So, the idea is to use a checkbox question of all workshops and then depending on a previous question that defines how many they bought (via a question event or completion event that would take them to a specific page), they would be limited to one, two, three or four checks. My initial thought would be some sort of SQL validation that would count the number of checkboxes and return an error/notification if they didn't select enough or too many. Any ideas on how that could be done? Is there a better way to do this?

    -Tim

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    04-07-2010 07:12 AM
    HI, the best way to handle this would be to use SQL validation on the checkbox group. Call a stored procedure, perform your logic there and return IsValid = 1 for passing validation or IsValid = 0 for not passing validation.

    The SQL validation would loop/parse the checkbox group string submission and perform a counter to determine how many options they choose. -- David
    THSUser is Offline
    going with the flow
    going with the flow
    Posts:48
    Avatar

    --
    04-07-2010 07:27 AM

    Hi David -

    OK... rethinking this I realized I'll still have to use radio buttons to group the workshops since there's the concurrent date/time issue. So, I'd have to have the following radio button groups:

    Monday AM

    WS1
    WS2
    WS3
    WS4

    Monday PM

    WS1
    WS2
    WS3
    WS4

    Tuesday AM

    WS1
    WS2
    WS3
    WS4

    Tuesday PM

    WS1
    WS2
    WS3
    WS4

    So, the question now is is there a way to SQL validate these four radio options and count whether they selected 1 thru 4 and then present a message like "only select one workshop", "only select two workshops", etc.

    -Tim

    THSUser is Offline
    going with the flow
    going with the flow
    Posts:48
    Avatar

    --
    04-07-2010 08:13 AM

    I'm now thinking with this scenario that a jscript would be the better way to go that would "count" the number of selections and then based on an if statement comapring to a constant (1,2,3,4) would then display a message about having to select the appropriate number of workshops and prevent the page from submitting... does that make sense?

    -Tim

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    04-08-2010 07:14 AM
    HI, yes this is possible. You can create an SQL stored procedure, passing all four radio button shortname tokens along and check if each of the radio buttons are blank or have values in them and increment a counter and based on the counter, return the IsValid value for what you want valid or not. -- David


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi