Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

3712 Posts in 470 Topics by 369 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Javascript Behaviours for DataobjectManager Popup?

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: UncleCheese

Page: 1
Go to End
Author Topic: Javascript Behaviours for DataobjectManager Popup? 603 Views
  • Anatol
    avatar
    102 posts

    Javascript Behaviours for DataobjectManager Popup? Link to this post

    Hi,

    I'm trying to add a JavaScript behaviour to the DataobjectManager Popup like this:

    Behaviour.register({
       '#DataObjectManager_Popup_DetailForm_MediaType': {
          onchange: function() {
             alert('changed'); // more useful code here
          },
          initialize: function() {
             this.onchange();
          }
       }
    });

    I'm not quite sure where to add the JavaScript file:

    Requirements::javascript('mysite/javascript/eventbehaviours.js');

    After some failed attempts I added it to the DataObjectManager_Popup class in DataObjectManager.php and at least I get an error message that says: "Behaviour is not defined". Where do I need to add the required JavaScript file? I guess the problem is that it has to come after /jsparty/behaviour.js but wherever I put it it appears earlier in the HTML code.

    Cheers!
    Anatol

  • UncleCheese
    avatar
    Forum Moderator
    2667 posts

    Re: Javascript Behaviours for DataobjectManager Popup? Link to this post

    DataObjectManager doesn't work with the Behavior class, so it gets blocked. You'll have to assign the behaviors using JQuery.

  • Anatol
    avatar
    102 posts

    Re: Javascript Behaviours for DataobjectManager Popup? Link to this post

    Thanks Uncle Cheese! I really appreciate your support and fantastic modules.

    Cheers!
    Anatol

    603 Views
Page: 1
Go to Top

Currently Online: paul.mcilwaine, motly, jondbaker, sicp

Welcome to our latest member: fearofbuttons

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

Comments on this website? Please give feedback.