Can anyone help me with below code which works fine in 1.5 but not with 1.7

JS File.
========
Form.YooEventObserver = Class.create();

Form.YooEventObserver.prototype = Object.extend(new 
Abstract.EventObserver(), {

  minQueryLength: 3,
  
  getValue: function() {
    // return YAHOO.util.Connect.setForm(this.element);
    //return Form.serialize(this.element);
  },
  
  registerFormCallbacks: function() {
    Event.observe(this.element, 'reset', this.onFormResetEvent.bind(this));
    Form.getElements(this.element).each(this.registerCallback.bind(this));
  },
  
  formResetAction: function() {
    var value = this.getValue();
    // calling again so that serialization is correct
    value = this.getValue();
    this.lastValue = value;
    this.lastCallbackValue = value;
    this.callback(this, value + '&reset=true');
  },
  
  onFormResetEvent: function(){
    // Delaying so that serialization is correct
    setTimeout(this.formResetAction.bind(this), 10)
    //this.formResetAction.bind(this)
  },
  
  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },
  
  onTextElementEvent: function(el) {
    var value = this.getValue();
    if (this.lastValue != value) {
      if ( 
        ((el.getValue() || '').length + 1 > this.minQueryLength  || 
(el.getValue() || '').length === 0 ) && 
        value != this.lastCallbackValue
      ){
        this.callback(this.element, value);
        this.lastCallbackValue = value;
      }
      this.lastValue = value;
    };
  },
  
  registerCallback: function(element) {
    this.lastCallbackValue = this.getValue();
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
        case 'text':
        case 'textbox':
        case 'textarea':
          new Form.Element.Observer(element, 0.22, 
this.onTextElementEvent.bind(this, element));
          break;
        case 'hidden':
          new Form.Element.Observer(element, 0.10, 
this.onElementEvent.bind(this));
          break;
        default:
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
  
});

Snippet from HTML
================

<script type="text/javascript">
    //<![CDATA[
    // form_name, callback_function
    // Ajax Updater (element, url )
    new Form.YooEventObserver('top-list-community-<%= 
content_class.to_s.downcase -%>-form',
      function(element, value) {
        new Ajax.Updater('top-list-community', 
          gY.tabs.getUrlWithType('<%= url_for(:action => :communitytop, :id 
=> page_user.id) %>'), 
          {asynchronous:true, evalScripts:true, parameters:value}
        );
      }
    )
    //]]>
  </script>

Main issues are when i do "new Abstract.EventObserver()" in chrome console 
then i am getting below error

TypeError: Object #<r> has no method 'getValue'

Any help is much appreciated 

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/r_IKHlckKkoJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to