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.

General Questions

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

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

[SOLVED] No value from database, for enum field


Reply

510 Views

Avatar
Parker1090

23 August 2012 at 7:13am (Last edited: 1 February 2013 11:38pm), Community Member, 38 Posts

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.