as the question says, I am trying to insert one or more tick box values into one database field, preferably in a comma delimited format.
So if the user chooses tick box one and tick box two, the input into the database will be inserted as tickOne, tickTwo, etc etc
How could I go about doing that?
Maybe using jQuery or Javascript?
Thanx in advance!
If you want to pass the values as a string, say comma delimited like you mentioned in jquery you could set the value using
.map(), like this:Every time a checkbox changes, it’ll re-do the string portion, re-serializing the result, so on postback it should be the current UI selection.
.map()gets an array of the values of the:checkedelements with yourmySelectorclass, then we’re just doing a.join()to convert that array into a string and using.val()to set the hidden input for this to that string.This assumes markup like this:
You can give it a try here