Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Problem with Field and javascript on first load of admin section

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

Page: 1
Go to End
Author Topic: 2186 Views
  • Apophenian
    Avatar
    Community Member
    46 Posts

    Problem with Field and javascript on first load of admin section Link to this post

    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

  • Apophenian
    Avatar
    Community Member
    46 Posts

    Re: Problem with Field and javascript on first load of admin section Link to this post

    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?

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Problem with Field and javascript on first load of admin section Link to this post

    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?

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Problem with Field and javascript on first load of admin section Link to this post

    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?

    2186 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.