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:

Archive /

Our old forums are still available as a read-only archive.

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

Onchange event in CMS

Go to End

3 Posts   1670 Views


Forum Moderator, 4102 Posts

3 September 2008 at 4:13am

I'm trying to unobtrusively attach an onchange event to a select box on my CMS page. I've figured out that i can add custom script to a specific module using the augmentInit() function off the DataObjectDecorator.

What's confusing to me is that the window.onload() event seems to fire when the silverstripe logo comes up, which is before my select box is loaded into the DOM.

Anyone know how this is usually done?


Community Member, 244 Posts

3 September 2008 at 9:58am

Edited: 03/09/2008 9:58am

Hi UncleCheese,

something like this is normally used:

	'select.domSelector' : {
		initialize: function () {
			// etc
		onclick: function() {

Not only will this get applied on page startup, but itll also be reapplied whenever a page is loaded using AJAX.


Forum Moderator, 4102 Posts

4 September 2008 at 5:08am

Perfect! What a great solution. So glad I posted here. I was sure no one would have an answer!