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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Can't save a link from the CMS to the database


Go to End


3 Posts   1211 Views

Avatar
evjan

Community Member, 7 Posts

1 October 2009 at 8:08am

Hi,

I'm trying do modify the template for a page so that the admin can select where a certain element on the page redirects. I'm trying to use something like the following:

static $has_one= array(
        "InternalLink" => "SiteTree"
);

The field shows up in the CMS and I can edit the link. But when I save it it doesn't seem to be persisted into the database, and the link when viewing the page just points to $siteroot//

I've built the site and a field called examplenameID does show up in the database. But it never changes from 0.

What am I doing wrong?

Kind regards
Peter (a silverstripe newbie)

Avatar
Willr

Forum Moderator, 5523 Posts

1 October 2009 at 6:45pm

Are you using a TreeDropdown field for selecting the site tree or a dropdown field?.

With these you will need to make sure that the field name includes the id - RelationshipNameID rather then just RelationshipName

new TreeDropdownField('InternalLinkID', 'Link'...

Avatar
evjan

Community Member, 7 Posts

5 October 2009 at 5:14am

That was the key, I changed the parameter and everything started working.

Thanks!