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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Updating DOM values derived other DOM fields and the site tree


Go to End


2 Posts   712 Views

Avatar
theoldlr

Community Member, 103 Posts

19 November 2010 at 12:38pm

I have a DOM with an image, image height, image width, link ID assigned by a SimpleTreeDropdownField, and a link name which is just a friendly view of what page the link ID is for.

I'm using an onBeforeWrite to grab the height and width of the image as well as the link name from the link ID. In this scenario if somebody uploads a replacement image with the same name and different dimensions, or changes the Page Name of a page that is linked, the info in the DOM will be incorrect. What is the best way for me to keep the DOM info accurate?

Also, is there any way to include a null option in the SimpleTreeDropdownField in the case that I would not want to include a link on a particular object?

Thanks!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

20 November 2010 at 3:55am

Yeah, it works just like a DropdownField..

$dropdown = new SimpleTreeDropdownField(...);
$dropdown->setEmptyString(_t('Mysite.PLEASESELECT','Please select'));

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com