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.

Customising the CMS /

Problem with Field and javascript on first load of admin section


Reply


4 Posts   2247 Views

Avatar
Apophenian

Community Member, 46 Posts

20 March 2009 at 1:37pm

I have a form field that subclasses ComplexTableField. I am including a javascript file in the constructor of the field, and I can see that the include is showing in the html source when the admin section is loaded, but it does not seem to be firing! Even if I only put an alert into the javascript file, nothing shows, unless I do a reload of the admin section.

Has anyone had a similar problem?

Cheers,

Rane

Avatar
Apophenian

Community Member, 46 Posts

4 June 2009 at 3:50pm

Sorry for the bump, but I am having a similar issue but in a different context.

I basically have a dropdownlist with some javascript included, but this doesn't seem to be included into the admin section on the first load of the admin section.

Anyone have any ideas?

Avatar
MarcusDalgren

Community Member, 288 Posts

28 June 2009 at 3:39am

I am having the exact same issue when helping Uncle Cheese with the DatePickerField.
If I reload a page with a DatePickerField on then all the correct javascript code gets loaded.

I can see that other fields like the Calendar field get all their requirements loaded even though I'm on a page which doesn't have one so there must be something more that needs to be done than using Requirements::javascript().

Could someone help us please?

Avatar
MarcusDalgren

Community Member, 288 Posts

17 August 2009 at 8:31am

Bumping this since this is preventing me (and others I guess) from creating our own fields and using them in the CMS.

Like I said in the previous post, the requirements of my fields only get loaded if I reload the page they are used on, not if the page is loaded via AJAX. I have checked the other field types that SilverStripe uses and they don't have any other special code as far as I can see. They all use Requirements:: and they get their stuff loaded correctly.

Could one of the developers (or if someone else knows) please tell us the secret?