1

I'm having a problem where Drupal behaviors seem to work with logged in users, but not everyone else, except when the behavior is executing a submit().

For example this won't work.

Drupal.behaviors.login_activate = {
  attach: function (context, settings) {
    $("#sr_login", context).hover(
      function(){
        $(this).append($("<span> ***</span>"));
      },
      function(){
        $(this).find("span:last").remove();
      }
    );
  }
};

This does work.

Drupal.behaviors.foundation_donation = {
  attach: function (context, settings) {
    $('#monthly_submit').click(function(){
      $('#monthly_donation').submit();
    });
    $('#single_submit').click(function(){
      $('#single_donation').submit();
    });
  }
};
apaderno
  • 28,547
  • 16
  • 75
  • 90
RJ Johns
  • 47
  • 7
  • 1
    Just to get the obvious stuff out of the way: How are you adding these scripts for the page? You're sure they are being included for non-authenticated users? And the attach event isn't firing at all? It's not just the subsequent jquery not working? – Andrew May 09 '13 at 06:57
  • 1
    what is your question? – Aboodred1 May 10 '13 at 00:46
  • 1
    I think I figured out the problem after checking if the event was firing. It is. On this page http://dev.worldviewweekend.com/situation-room apparently none of the behaviors are working because of an error saying .once() in base.js is not a function. However, on this page http://dev.worldviewweekend.com/tube which includes the same base.js file behaviors do work. I can't figure out why the error is on one page and not the other. – RJ Johns May 10 '13 at 01:08
  • 2
    The JS error seems to be killing Drupal behaviors. I can't figure out why the error is present. See previous comment for links and details. Any help / guidance is greatly appreciated. – RJ Johns May 10 '13 at 15:40

0 Answers0