diff --git a/public/js/legacy/widgets/form/fields.js b/public/js/legacy/widgets/form/fields.js
index a4a0dbdc97..fdfa8ccc13 100644
--- a/public/js/legacy/widgets/form/fields.js
+++ b/public/js/legacy/widgets/form/fields.js
@@ -167,7 +167,7 @@ Field.prototype.get_status = function() {
if(this.in_grid)
a_o_s = this.grid.field.df.allow_on_submit;
if(this.frm.meta.istable) {
- a_o_s = cur_grid.field.df.allow_on_submit;
+ a_o_s = _f.cur_grid.field.df.allow_on_submit;
}
}
@@ -506,7 +506,7 @@ DateField.prototype.make_input = function() {
this.user_fmt = sys_defaults.date_format;
if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
- this.input = $("").appendTo(this.input_area).get(0);
+ this.input = $("").appendTo(this.input_area).get(0);
$(this.input).datepicker({
dateFormat: me.user_fmt.replace('yyyy','yy'),
diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js
index 8c3ac5aefb..ff575742ed 100644
--- a/public/js/legacy/widgets/form/form.js
+++ b/public/js/legacy/widgets/form/form.js
@@ -562,7 +562,10 @@ _f.Frm.prototype.refresh = function(docname) {
// focus on first input
if(this.doc.docstatus==0) {
- $(this.wrapper).find('.form-layout-row :input:first').focus();
+ var first = $(this.wrapper).find('.form-layout-row :input:first');
+ if(first.attr("data-fieldtype")!="Date") {
+ first.focus();
+ }
}
} else {
diff --git a/public/js/wn/ui/dialog.js b/public/js/wn/ui/dialog.js
index 7b2218a84b..35929b0d4c 100644
--- a/public/js/wn/ui/dialog.js
+++ b/public/js/wn/ui/dialog.js
@@ -94,7 +94,10 @@ wn.ui.Dialog = wn.ui.FieldGroup.extend({
if(this.onshow)this.onshow();
// focus on first input
- $(this.wrapper).find(':input:first').focus();
+ var first = $(this.wrapper).find(':input:first');
+ if(first.attr("data-fieldtype")!="Date") {
+ first.focus();
+ }
},
hide: function() {
// call onhide