3372 Posts in 998 Topics by 712 members
|Go to End|
4 September 2012 at 8:31pm Last edited: 10 January 2013 12:01am
I have a list of values for my Enum() field which has an option containing a comma. Unfortunately, due to accuracy of information on the site, I do not have the option to re-word this option.
Can anyone tell me how to escape commas in the Enum() values?
Thanks in advance.
EDIT: This is for Silverstripe 2.4.7
6 September 2012 at 11:23pm
Hi, welcome to the forums,
I've never tried this, but you should be able to use an array of values instead of a comma separated list. So maybe you can sneak in the comma that way...
6 September 2012 at 11:31pm
Hmmm, I did not know that. I'll give it a shot, thank you!
8 September 2012 at 2:41am
@martimiz & @Spambanjo
would be very interested if this is possible - I asked and Willr said it wasn't a while back...
8 September 2012 at 5:02am
I looked at the Enum code in 3.0 - it explodes the list to an array, unless it is already an array. So that should be ok. Don't really know what happens with the array when the field is created. Hence the slight hesitation. Easily testable though...
9 September 2012 at 2:45am
You can do something like "Enum(array('First Value', 'Second Value'))"
11 September 2012 at 8:58pm
Hi, sorry for my lack of input on this thread, I've been doing a different job and haven't had time to test this yet. I will reply as soon as I have a chance to test this
I also apologise if this thread is in the wrong place, but this was actually a question for Silverstripe 2.4
11 September 2012 at 10:36pm Last edited: 11 September 2012 10:38pm
Code for 2.4.7 looks about the same, so that should work as well...
And sure, this is the right place, there are no separate forums for 3.0 or 2.4. This can be confusing, because of the major differences in both versions, so people: please mention your version. (just taking the opportunity to mention this )
|Go to Top|