Announcement

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

    TypeError: _5 is undefined

    SC_SNAPSHOT-2010-10-03/EVAL Deployment

    I have a couple of DynamicForms with FormItems of various types including some CanvasItems where the Canvas is another DynamicForm. These forms are in different Tabs of a TabSet which is inside a Window. Everything works fine except that from time to time (not sure what causes it) the CanvasItems float on top of the other FormItems in the same form, and each other.

    For example, one of the forms has a bunch of FormItems listed first, followed by two CanvasItems, each with another form as it's canvas with a few fields on each. Once every few times the window is drawn one of these forms will show the CanvasItems floating on top of the other form items at the top of the form.

    When this happens and I try to move or resize the Window the developer console shows Uncaught JavaScript exception [_5 is undefined] in http://127.0.0.1:8888/ipgui/sc/modul...version=7.0.js, line 1485.

    #2
    Can you post the stack trace from the JS error, and your DynamicForm definitions?
    Also - any strange warnings in the developer console that might give us a hint as to what's going on?

    Thanks

    (A standalone test case we can use to reproduce things on our end is always ideal of course, but the above might shed some light on things!)

    Comment


      #3
      No warnings in the console.

      Here is the stack trace from the console.
      Code:
      10:54:25.961:MUP9:WARN:Log:TypeError: _5 is undefined
          [c]EventHandler.handleDragStop()
          EventHandler._handleMouseUp([object MouseEvent], undef)
          [c]EventHandler.handleMouseUp(_1=>[object MouseEvent])
          [c]EventHandler.dispatch(_1=>isc_c_EventHandler_handleMouseUp,  _2=>[object MouseEvent])
          anonymous([object MouseEvent])
          unnamed()
      The forms are all created using this same method.
      Code:
      private DynamicForm getStandardForm() {
      	DynamicForm stdForm = new DynamicForm() {
      
      		@Override
      		public void saveData() {
      			savePo(null);
      		}
      	};
      	stdForm.setSelectOnFocus(true);
      	stdForm.setWrapItemTitles(false);
      	stdForm.setNumCols(4);
      	stdForm.setFixedColWidths(false);
      	stdForm.setDataSource(poHeaderDS);
      	stdForm.setSaveOnEnter(true);
      	poHeaderVM.addMember(stdForm);
      	stdForm.addSubmitValuesHandler(new SubmitValuesHandler() {
      		@Override
      		public void onSubmitValues(SubmitValuesEvent event) {
      			savePo(null);
      		}
      	});
      	return stdForm;
      }
      It happens on a few different forms, but it seems only with CanvasItems. Here is the code that creates one of the forms where it happens. In this case it is the commentsCanvas that sometimes float on top of the rest.
      Code:
      poHeaderFormBasics = getStandardForm();
      
      // Build a list of FormItems to add to this form
      ArrayList<FormItem> formFields = new ArrayList<FormItem>();
      
      // We'll include as HiddenItems all of the fields we need
      // to send to the server on an add request but aren't showing.
      formFields.add(new HiddenItem("HFGP"));
      formFields.add(new HiddenItem("HUA#"));
      formFields.add(new HiddenItem("HRNO"));
      formFields.add(new HiddenItem("HDRP"));
      formFields.add(new HiddenItem("HPSP"));
      
      // Blockout number on left, PO Number on right.
      // Icon next to Blockout number works as toggle to switch between 
      // auto-assign for PO# or using blockout as PO#. 
      // Toggled choice is stored in HUA# as a boolean.
      TextItem hblk = new TextItem("HBLK");
      hblk.addChangedHandler(new ChangedHandler() {
      	@Override
      	public void onChanged(ChangedEvent event) {
      		if ("true".equals(poHeaderVM.getValueAsString("HUA#")))
      			poHeaderVM.setValue("HONO", (String) event.getValue());
      	}
      });
      hblk.setMask(">AAAAAAAAAA");
      formFields.add(hblk); 
      formFields.add(getHONOItem());
      
      
      // Vendor
      SelectItem hven = getCodeNameSelectItem("HVEN", "VVEN", "VNAM", "IPMRVEN");
      hven.addChangedHandler(new ChangedHandler() {
      	@Override
      	public void onChanged(ChangedEvent event) {
      		setVendorDefaults();
      	}
      });
      
      formFields.add(hven);
      
      applyTemplateSelector = new SelectItem("TPNAME");
      applyTemplateSelector.setTitle("Apply Template");
      applyTemplateSelector.setOptionDataSource(DataSource.get(IslandPacificDSConstants.DATASOURCE_IPTPHDR));
      applyTemplateSelector.addChangedHandler(new ChangedHandler() {
      	@Override
      	public void onChanged(ChangedEvent event) {
      		setTemplateDefaults();
      	}
      });
      FormItemIcon applyTemplateIcon = new FormItemIcon();
      applyTemplateIcon.setSrc("customimages/Save.gif");
      applyTemplateIcon.setPrompt("Click to save current PO details as a template.");
      applyTemplateIcon.addFormItemClickHandler(new FormItemClickHandler() {
      	@Override
      	public void onFormItemClick(FormItemIconClickEvent event) {
      		// TODO Pop up a window to let them save current field values as a template.
      		SC.say("Template maintenance feature has not been implemented.");
      	}
      });
      applyTemplateSelector.setIcons(applyTemplateIcon);
      formFields.add(applyTemplateSelector);
      
      // Banner 
      // TODO Implement new Banner table with 8-char key linked to unused IPPOHDR field H##3
      formFields.add(new SelectItem("H##3")); 
      
      // Ship to store
      SelectItem hstr = getCodeNameSelectItem("HSTR", "SSTR", "SNAM", "IPSTORE");
      Criteria hstrCriteria = new Criteria("SARC", "Y");
      hstrCriteria.addCriteria(new Criteria("SAOR", "Y"));
      hstr.setPickListCriteria(hstrCriteria);
      formFields.add(hstr);
      
      // Department
      formFields.add(getCodeNameSelectItem("HDPT", "DDPT", "DNAM", "IPDEPTS"));
      
      // Buyer ID
      formFields.add(new TextItem("HBYR"));
      
      // Order Type, Commodity
      formFields.add(getOrderTypeSelector());
      formFields.add(new TextItem("HCMD"));
      
      // Order Date, Ship Date
      formFields.add(getLiveDateField("HODI"));
      formFields.add(getLiveDateField("HSDI"));
      
      // Anticipate Date, Cancel Date
      formFields.add(new DateItem("HADI"));
      formFields.add(new DateItem("HCDI"));
      
      // Buyer, Original Anticipate date
      StaticTextItem hoai = new StaticTextItem("HOAI");
      hoai.setShowIfCondition(new FormItemIfFunction() {
      	@Override
      	public boolean execute(FormItem item, Object value,
      			DynamicForm form) {
      		return !(value==null || value.toString().isEmpty());
      	}
      });
      hoai.setRedrawOnChange(true);
      formFields.add(hoai);
      
      // Handling Type
      formFields.add(new SelectItem("HHND"));
      
      // TODO These fields need to be stored 
      // in a new table keyed to the file group and PO number
      TextItem orderedBy = new TextItem("OrderedBy");
      orderedBy.setStartRow(true);
      formFields.add(orderedBy); 
      formFields.add(new TextItem("ApprovedBy"));
      
      // List of users to notify
      formFields.add(new RowSpacerItem());
      CanvasItem notifyCanvas = new CanvasItem();
      notifyCanvas.setTitle("Notify Users");
      DynamicForm notifyForm = getStandardForm();
      notifyForm.setNumCols(3);
      notifyForm.setColWidths("*","*","*");
      SelectItem hnu1 = getCodeNameSelectItem("HNU1", "UMGQ", "UNAM", "IPUSERS");
      SelectItem hnu2 = getCodeNameSelectItem("HNU2", "UMGQ", "UNAM", "IPUSERS");
      SelectItem hnu3 = getCodeNameSelectItem("HNU3", "UMGQ", "UNAM", "IPUSERS");
      hnu1.setShowTitle(false);
      hnu2.setShowTitle(false);
      hnu3.setShowTitle(false);
      notifyForm.setFields(hnu1, hnu2, hnu3);
      notifyCanvas.setCanvas(notifyForm);
      notifyCanvas.setColSpan(4);
      formFields.add(notifyCanvas);
      
      // Internal comment fields span 4 columns.
      formFields.add(new RowSpacerItem());
      DynamicForm commentsForm = getStandardForm();
      commentsForm.setIsGroup(true);
      commentsForm.setGroupTitle("Internal Comments");
      commentsForm.setFields(
      		getLongCommentItem("HBC1"),
      		getLongCommentItem("HBC2"), 
      		getLongCommentItem("HBC3"));
      commentsForm.setPadding(5);
      commentsForm.setWidth(470);
      CanvasItem commentsCanvas = new CanvasItem();
      commentsCanvas.setShowTitle(false);
      commentsCanvas.setColSpan(4);
      commentsCanvas.setCanvas(commentsForm);
      formFields.add(commentsCanvas);
      
      // Now put all form items on the form.
      FormItem[] formFieldsArray = new FormItem[formFields.size()];
      formFieldsArray = formFields.toArray(formFieldsArray);
      poHeaderFormBasics.setFields(formFieldsArray);
      I realize I could probably use a Layout to accomplish the same thing, but one of the reasons for using CanvasItems is that they can have a title that gets sized appropriately along with the other FormItems on the form. In this example the notifyCanvas takes advantage of that aspect of a CanvasItem that I couldn't achieve using a layout unless I set an arbitrary fixed width for titles.

      Comment


        #4
        Based on the stack trace, we've added a null check which will resolve this JS error.
        Let us know if you continue to see this problem (after tonight's nightly build)

        Comment


          #5
          Thanks. I'll get a new nightly soon. Does this fix also take care of the CanvasItem floating above the other FormItems?

          Comment

          Working...
          X