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

Bug? Form field's title parameter using a DBField name


Go to End


2 Posts   571 Views

Avatar
colymba

Community Member, 26 Posts

14 November 2011 at 5:26am

Hi,

Just came across a strange behaviour while adding CMS fields (SS 2.4.6).

When a NumericField or TexField (the only ones I have texted) with the title parameter equal to a DBField name, the form field is skipped from the CMS interface with no error or warning.

In my case, I had:

static $db = array (
    'ImagesDisplayOrder' => 'Int(1)'
);
static  $has_many = array(
    'Images' => 'ImagePiece'
);

/* ... */

$fields->addFieldToTab("Root.Content.Main", new NumericField('ImagesDisplayOrder', "Images")); // not displayed in CMS
$fields->addFieldToTab("Root.Content.Main", new NumericField('ImagesDisplayOrder', "Pictures")); // works as expected 

Not sure if this is a bug, but I can't find any other explication as it shouldn't matter what's in the title attribute?
Can anybody replicate this?

Thanks, Thierry

Avatar
martimiz

Forum Moderator, 1391 Posts

14 November 2011 at 7:54am

Edited: 14/11/2011 7:55am

oops - wrong post, sorry...