Jump to:

23355 Posts in 17734 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] No value from database, for enum field

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

Page: 1
Go to End
Author Topic: 478 Views
  • Parker1090
    Avatar
    Community Member
    38 Posts

    [SOLVED] No value from database, for enum field Link to this post

    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.

    478 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.