Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Form destruction issue

    I believe we have identified a bug in version 6.0 though it appears to be in current 7 beta though we haven't fully tested on that version. The issue is the SelectItem's setValueMap method clearing it's pickList's formItem property, if the value map is set on an already drawn select item and the user does not open the drop down before the form is destroyed you will see an error stating "this.formItem is null or not an object". The cause is that in pickList.hide it attempts to use that property without checking that it exists not a bad place to fix it, however an easier fix is on the formItem's destroy method to check to see if the pick list is visible before calling hide on it. Below is the proposed patch:

    Code:
    if(window.isc.FormItem) {
      window.isc.FormItem.addProperties({
        destroy:function() {
            if(this.isDrawn()) {
              this.cleared();
            }
            var pickList=this.pickList;
            this.pickList=null;
            if (pickList!=null&&pickList!=window.isc.PickList.$14w) { // $14w=_pickListInstance
                // \/ \/ \/ this is the change \/ \/ \/
                if(pickList.isVisible()) { pickList.hide(); }
                // /\ /\ /\ this is the change /\ /\ /\
                pickList.destroy();
            }
    
            this.destroyed=true;
            this.form=null;
            this.$14x=null; // $14x=_dataElement
            
            var undef;
            if(window[this.ID]==this) {
              window[this.ID]=undef;
            }
        }
      });
    }
    for highly dynamic select items this is a common activity however in normal usage it's probably not that large of an impact. Thanks for you consideration.

    -john

    #2
    Hi John,

    Thanks for looking deeply into this and proposing a patch.

    By "current 7 beta" are you saying this happens in 7.0RC or just 7.0 beta?

    Comment


      #3
      I believe the latest I downloaded was the LGPL 7.0 beta, not the RC. Code looks like it would happen though I haven't loaded it up to make sure.

      -john

      Comment

      Working...
      X