Here is the code for a button that opens a window to make a new instance. It sets up a pickList criteria for a selectItem on the form and does a fetchData on the item. The callback fires, shows the item and hides another. Then shows the window and changes the title.
That works fine. The SAVE button works, too.
The problem is that when I navigate to any other form that has a selectItem on the same dataSource (TeamMember) the callback fires again when I click on it or when it automatically autofetches. This is very odd behavior because the new window is modal. It is also a surprise.
Here is the form.
Here is the console log. It starts with clicking the NEW subscriber button. You can see the callback fires after the click code ends showing the window.
Then you can see me navigate away to another tab and open a project window. On that form is a TeamMemberID selectItem. I can click on it and get the odd behavior. At the bottom note that the callback fires again.
Any ideas how I could be causing this? I was starting to get the hang of callbacks. This came out of left field.
Thanks
Rick
P.S. I am running SmartClient Version: v8.3p_2014-06-27/EVAL on Mozilla Firefox 20.0 with Firebug using Windows 7 Premium 64 bit.
That works fine. The SAVE button works, too.
The problem is that when I navigate to any other form that has a selectItem on the same dataSource (TeamMember) the callback fires again when I click on it or when it automatically autofetches. This is very odd behavior because the new window is modal. It is also a surprise.
Code:
form.clearValues(); form.setValue("CommunityID", Application.currentCommunityID ) ; form.setValue("ProjectID", Application.currentProjectID ) ; form.setValue("IssueID", Application.currentIssueID ) ; form.setValue("StatusChangeOption", true); form.setValue("AnyChangeOption", false); form.setValue("DueReminderOption", false); form.setValue("DueReminderTime", "08:00 AM"); form.rememberValues(); form.setSaveOperationType("add"); form.getItem("SaveButton").setDisabled(true); form.getItem("UndoButton").setDisabled(true); form.getField("TeamMemberID").setProperty("pickListCriteria", { "CommunityID" : Application.currentCommunityID, "IssueID" : Application.currentIssueID } ); form.getField("TeamMemberID").fetchData( function (item, dsResponse, data, dsRequest) { if (dsResponse.status >= 0) { item.show(); form.getField("TeamMemberName").hide(); IssueSubscriberWindow.show(); IssueSubscriberWindow.setTitle("New Subscriber for Issue " + Application.currentIssueNumber + ": " + Application.currentIssueTitle); } else { m4_ifelse(m4_eval(debugPriority>=2),1,Log.logError("ERROR: form.getField(TeamMemberID).fetchData dsResponse: " + Log.echo(dsResponse));)m4_dnl } }, // end of fetchData function { showPrompt: true, prompt: "Loooking for valid subscribers...", containsCredentials: false } ) // end of fetchData call
Code:
isc.DynamicForm.create({ ID:"IssueSubscriberForm", autoDraw:false, dataSource:"IssueSubscriber", numCols:6, overflow:"hidden", fields:[ { name:"IssueID", visible:false, disabled:false, _constructor:"TextItem" }, { name:"ProjectID", visible:false, disabled:false, _constructor:"TextItem" }, { name:"CommunityID", endRow:true, visible:false, disabled:false, _constructor:"TextItem" }, { name:"TeamMemberID", title:"Team Member", width:300, colSpan:3, required:true, valueField:"TeamMemberID", displayField:"TeamMemberName", optionDataSource:TeamMember, optionOperationId:"excludeCurrentIssueSubscribers", cachePickListResults:"false", _constructor:"SelectItem" }, { canEdit:false, name:"TeamMemberName", title:"Team Member", width:300, colSpan:3, visible:false, shouldSaveValue:false, disabled:false, _constructor:"TextItem" }, { name:"UndoButton", title:"UNDO", startRow:false, endRow:false, disabled:true, click:"Log.setPriority(\"Log\", 5);\nLog.logDebug(\"********************** IssueSubscribersForm.UndoButton.Click\");\n\n var form = this.form;\n form.reset();\n form.changesPending = false;\n form.newLogEntry = null;\n form.getItem(\"SaveButton\").setDisabled(true);\n form.getItem(\"UndoButton\").setDisabled(true);\n form.clearErrors(true);\n\nLog.logDebug(\"***END***END***END*** IssueSubscribersForm.UndoButton.Click\");", _constructor:"ButtonItem" }, { name:"SaveButton", title:"SAVE", startRow:false, disabled:true, click:"IssueSubscriberForm_SaveButton_click(this)", //click:"\n Log.setPriority(\"Log\", 5);\n Log.logDebug(\"********************** IssueSubscriberForm.SaveButton.Click\");\n var form = this.form;\n if (form.validate(false)) {\n form.saveData();\n if (!form.hasErrors()) {\n oldValues = null;\n newValues = null;\n form.rememberValues();\n form.newLogEntry = null;\n form.getItem(\"SaveButton\").setDisabled(true);\n form.changesPending = false;\n IssueSubscriberWindow.closeClick();\n } else {\n alert(\"errors during save.\");\n }\n } else {\n alert(\"validation failed.\");\n }\n Log.logDebug(\"***END***END***END*** IssueSubscriberForm.SaveButton.Click\");", _constructor:"ButtonItem" }, { name:"AnyChangeOption", title:"Any Change Option", titleOrientation:"top", _constructor:"CheckboxItem" }, { name:"StatusChangeOption", title:"StatusChangeOption", titleOrientation:"top", prompt:"Select to be alerted on changes in status, due date or owner.", _constructor:"CheckboxItem" }, { name:"DueReminderOption", title:"Due Reminder Option", titleOrientation:"top", startRow:false, _constructor:"CheckboxItem" }, { name:"DueReminderDate", title:"Due Reminder Date", titleOrientation:"top", _constructor:"DateItem" }, { name:"DueReminderTime", title:"Due Reminder Time", titleOrientation:"top", _constructor:"TimeItem" } ], width:"100%", height:"100%", visibilityChanged:"", itemChanged:"Log.setPriority(\"Log\", 5);\nLog.logDebug(\"********************** IssueSubscribersForm.itemChanged\");\n\n this.getItem(\"SaveButton\").setDisabled(false);\n this.getItem(\"UndoButton\").setDisabled(false);\n\nLog.logDebug(\"***END***END***END*** IssueSubscribersForm.itemChanged\"); " })
Then you can see me navigate away to another tab and open a project window. On that form is a TeamMemberID selectItem. I can click on it and get the odd behavior. At the bottom note that the callback fires again.
16:45:57.522:MUP6:INFO:Log:********************* IssueSubscriber_NewButton_click
16:45:57.760:MUP6:INFO:Log:***END***END***END*** IssueSubscriber_NewButton_click
16:45:58.748:XRP8:DEBUG:Log:**** TeamMemberID fetchData callback fired for {"CommunityID":101,"IssueID":101}
16:46:06.959:IFCS7:DEBUG:Log:********************** IssueSubscribersForm.itemChanged
16:46:06.982:IFCS7:DEBUG:Log:***END***END***END*** IssueSubscribersForm.itemChanged
16:46:11.918:IBLR6:DEBUG:Log:********************** IssueSubscribersForm.itemChanged
16:46:11.919:IBLR6:DEBUG:Log:***END***END***END*** IssueSubscribersForm.itemChanged
16:46:12.033:MUP1:INFO:Log:********************* IssueSubscriberForm_SaveButton_click
16:46:12.216:MUP1:INFO:Log:***END***END***END*** IssueSubscriberForm_SaveButton_click
16:46:36.569:MUP5:INFO:Log:********************* IssueForm_visibilityChanged
16:46:36.569:MUP5:INFO:Log:***END***END***END*** IssueForm_visibilityChanged
16:47:01.790:MUP2:DEBUG:Log:*************** MainForm_tabDeselected
16:47:01.791:MUP2:DEBUG:Log:*************** MainForm_tabSelected
16:47:06.065:MUP9:DEBUG:Log:********************** MyProjects.OpenProjectWindow
16:47:06.094:MUP9:DEBUG:Log:********************* LoadAllPrintOptions.jsp
16:47:06.199:MUP9:DEBUG:Log:***END***END***END*** LoadAllPrintOptions.jsp
16:47:06.307:MUP9:DEBUG:Log:**************** Application.ProjectIssue.get(0) invoked to start fetching on isc_ResultSet_29
16:47:06.413:MUP9:DEBUG:Log:***END***END***END*** MyProjects.OpenProjectWindow
16:47:23.120:XRP2:DEBUG:Log:**** TeamMemberID fetchData callback fired for {"CommunityID":101,"IssueID":101}
16:45:57.760:MUP6:INFO:Log:***END***END***END*** IssueSubscriber_NewButton_click
16:45:58.748:XRP8:DEBUG:Log:**** TeamMemberID fetchData callback fired for {"CommunityID":101,"IssueID":101}
16:46:06.959:IFCS7:DEBUG:Log:********************** IssueSubscribersForm.itemChanged
16:46:06.982:IFCS7:DEBUG:Log:***END***END***END*** IssueSubscribersForm.itemChanged
16:46:11.918:IBLR6:DEBUG:Log:********************** IssueSubscribersForm.itemChanged
16:46:11.919:IBLR6:DEBUG:Log:***END***END***END*** IssueSubscribersForm.itemChanged
16:46:12.033:MUP1:INFO:Log:********************* IssueSubscriberForm_SaveButton_click
16:46:12.216:MUP1:INFO:Log:***END***END***END*** IssueSubscriberForm_SaveButton_click
16:46:36.569:MUP5:INFO:Log:********************* IssueForm_visibilityChanged
16:46:36.569:MUP5:INFO:Log:***END***END***END*** IssueForm_visibilityChanged
16:47:01.790:MUP2:DEBUG:Log:*************** MainForm_tabDeselected
16:47:01.791:MUP2:DEBUG:Log:*************** MainForm_tabSelected
16:47:06.065:MUP9:DEBUG:Log:********************** MyProjects.OpenProjectWindow
16:47:06.094:MUP9:DEBUG:Log:********************* LoadAllPrintOptions.jsp
16:47:06.199:MUP9:DEBUG:Log:***END***END***END*** LoadAllPrintOptions.jsp
16:47:06.307:MUP9:DEBUG:Log:**************** Application.ProjectIssue.get(0) invoked to start fetching on isc_ResultSet_29
16:47:06.413:MUP9:DEBUG:Log:***END***END***END*** MyProjects.OpenProjectWindow
16:47:23.120:XRP2:DEBUG:Log:**** TeamMemberID fetchData callback fired for {"CommunityID":101,"IssueID":101}
Thanks
Rick
P.S. I am running SmartClient Version: v8.3p_2014-06-27/EVAL on Mozilla Firefox 20.0 with Firebug using Windows 7 Premium 64 bit.