Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

IN a dynamically (via SQL) generated survey I need to enforce a minimum on some checkbox questions. So let's say I have 10 colors and you need to "pick at least 2". Let's assume I have 3 of these questions in my survey.

 

Ideally, I would like the submit button onclick fire off an alert to tell the user that questions 1, 2, 3 need addressing if they don't have the minimum. I already have a CSS class that toggles to give a visual cue that the question isn't valid, but now I need to actually enforce it. (PS: server side isn't important now)

 

The only way I can think of doing this is to create a 3x4 array that contains (question#, checkbox name, number of checkboxes, min) .... which would look like (1, 'chkColor_', 10, 2). The function would take each row of the array, loop thourgh all the IDs (via 'chkColor' + for 0 to 9) and if the min isn't met, fire an alert that says "question "+ question + " requires at least "+ min +" choices."

 

Is there a more efficient way to do this then sending a 3x4 array?

Edited by travisowens
Experience is something you don't get until just after the moment you needed it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...