17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1250 Views |
-
Onchange event in CMS

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?
-
Re: Onchange event in CMS

3 September 2008 at 9:58am Last edited: 3 September 2008 9:58am
Hi UncleCheese,
something like this is normally used:
Behaviour.register({
'select.domSelector' : {
initialize: function () {
// etc
},
onclick: function() {
//etc
}
}
});Not only will this get applied on page startup, but itll also be reapplied whenever a page is loaded using AJAX.
-
Re: Onchange event in CMS

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!
| 1250 Views | ||
|
Page:
1
|
Go to Top |

