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.

Customising the CMS /

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

getCMSFields() jQuery usage, fails after clicking Save.


Go to End


2 Posts   1047 Views

Avatar
George Botley

Community Member, 18 Posts

3 January 2015 at 4:38am

Hi All,

I've got a custom jQuery script included on my DataObject using Requirements::javascript() within getCMSFields().

The purpose of this jQuery is to check the selected option of a dropdown and hide/show applicable fields related to this option.]

It works like a dream until the user clicks Save. After clicking Save, it would appear I am no longer able to reference any of the DOM objects within the CMS.

Am I doing something wrong? As why would it run perfectly on load, but not after Save - as the file is still included within the source code of the page.

Thanks for your help here, any suggestions?

P.S. Hope you all had a good new year.

Avatar
Devlin

Community Member, 344 Posts

13 January 2015 at 9:43pm

Did you tried to use jQuery().on()?

http://api.jquery.com/on/