I have a grid and an editor for editing each row values. In my editor, i have a this dijit.form.DateTextBox. I also have submit and cancel button.
On Edit button click, I open the grid popup editor, which has 1 form and bunch of other dojo controls including text box. Now I want to use the cancel button to Reset the form and hide the Dojo Grid Popup Dialog. I created a function for the same. It works fine when i remove the JavaScript which runs after DateTextBox onChange event.
It gives me this below error.
Uncaught TypeError: Cannot call method ‘getMonth’ of null
The JavaScript I have on DateTextBox onChange event is this.
dojo.connect(dijit.byId("Edit_TrialStartDate"), "onChange", function () {
var item = dojo.date.locale.format(dijit.byId("Edit_TrialStartDate").value, { datePattern: "MM/dd/yyyy", selector: "date" });
dijit.byId("Edit_tTrialStartDate").setValue(item);
});
Because if this error, my grid popup dialog never releases the ID it is registered with. So I can only edit 1 record at a time. When I click on another row Edit button I get this below error.
Uncaught Error: Tried to register widget with id==TrialGridPopUp but that id is already registered
Does anyone have any idea how to resolve this?
Somewhere in your code you are passing an object that is not a date into a method that is expecting a date.
I would verify that
dijit.byId("Edit_TrialStartDate").valueis giving you a date object.It’s also better practice to call
dijit.byId("Edit_TrialStartDate").get('value');