It seems that FormItIsSelected and FormItIsChecked have an undocumented (at least on the RTFM pages) feature: you can pass a comma-delimited list of values, and if any of them are matched, the snippet call will return positive (set the 'select' or 'checked' value).
This is cool, but... what if my actual value has a comma in it?
<input type="checkbox" name="times[]" value="Monday, AM" [[!+fi.times:FormItIsChecked=`Monday, AM`]] >
<input type="checkbox" name="times[]" value="Monday, PM" [[!+fi.times:FormItIsChecked=`Monday, PM`]] >
<input type="checkbox" name="times[]" value="Tuesday, AM" [[!+fi.times:FormItIsChecked=`Tuesday, PM`]] >
In this case, the snippet call does not return a match (because, of course, it is exploding the input string and trying to match EITHER 'Tuesday' OR ' PM').
I suppose commas in form element values are somewhat rare, but surely they aren't unheard of.
My first thought on a fix was to use something less likely to be in a form value, like a double bar '||'.
But my next thought was, it probably isn't good form to rely on the relative obscurity of the chosen delimiter. No matter how obscure, someone's eventually gonna have that in their form value, and is gonna be confused that the snippet isn't working right.
Maybe provide a way for the user to specify their own delimiter? So they can pick one they are sure won't show up in their values?
Or maybe there's a better way than that, even?
[ed. note: jrotering last edited this post 13 years, 8 months ago.]