Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED] No value from database, for enum field


Go to End


876 Views

Avatar
Parker1090

Community Member, 46 Posts

23 August 2012 at 7:13am

Edited: 01/02/2013 11:38pm

Hi All,
Still running 2.4.6 (I will get round to upgrading eventually, but my CMS has custom scripts and stuff), and I have a field added to Member for 'Title' (Mr, Miss, Mrs etc). This was defined in a new file as:

static $db = array(
'Title' => "Enum('Mr,Miss,Mrs,Ms,Dr,Rev')",
etc....

However, when you go into the Security tab, and edit a member, the drop down list for this field ALWAYS shows the first value, 'Mr'. I've also got other fields, such as:

'HeardFrom' => "Enum('Word of mouth,Email,Website link,Facebook,Search Engine,Other','Other')",

Which works fine. I know there's a difference where the HeardFrom has a default value, but surely that shouldn't make a difference?

I've tried all sorts to fix it, even to the extent where Title is now in the Member.php file (sapphire/security), but still doesn't work! However, the actual field in the database DOES update, but is not reflected on the form.

If you have any ideas, please please help, as this is bugging me.

Many Thanks,
Mathew

Update
It's annoying when I find posts with the same error as I have, and no solution. So, although this post is now old, I would like to add the following solution for those looking for it in the future:

Apparently, because the field was called 'Title', this caused the problem. Changing it to something like 'Salutation' seemed to fix the problem.