Merge branch 'handlerupdate' of github.com:webnotes/wnframework into handlerupdate
This commit is contained in:
commit
bab5f69eeb
5 changed files with 30 additions and 14 deletions
|
|
@ -1,7 +1,13 @@
|
|||
/* FORMS */
|
||||
|
||||
div.form-section-head {
|
||||
margin: 15px 0px 3px 0px;
|
||||
margin: 11px 0px 3px 0px;
|
||||
border-top: 1px solid #ccc;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
div.form-layout-row:first-child .form-section-head {
|
||||
border-top: 0px solid #ccc !important;
|
||||
}
|
||||
|
||||
div.form-section-head h3 {
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ function flt(v,decimals) {
|
|||
if(isNaN(v))
|
||||
v=0;
|
||||
if(decimals!=null)
|
||||
return v.toFixed(decimals);
|
||||
return parseFloat(v.toFixed(decimals));
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -400,7 +400,8 @@ DataField.prototype.make_input = function() {
|
|||
|
||||
this.get_value= function() {
|
||||
var v = this.input.value;
|
||||
if(this.validate)v = this.validate(v);
|
||||
if(this.validate)
|
||||
v = this.validate(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -811,7 +812,9 @@ IntField.prototype.format_input = function() {
|
|||
|
||||
function FloatField() { } FloatField.prototype = new DataField();
|
||||
FloatField.prototype.validate = function(v) {
|
||||
var v= parseFloat(v); if(isNaN(v))return null;
|
||||
var v= parseFloat(v);
|
||||
if(isNaN(v))
|
||||
return null;
|
||||
return v;
|
||||
};
|
||||
FloatField.prototype.format_input = function() {
|
||||
|
|
@ -831,7 +834,7 @@ CurrencyField.prototype.format_input = function() {
|
|||
|
||||
CurrencyField.prototype.validate = function(v) {
|
||||
if(v==null || v=='')
|
||||
return 0;
|
||||
return 0;
|
||||
return flt(v,2);
|
||||
}
|
||||
CurrencyField.prototype.set_disp = function(val) {
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ _f.Frm = function(doctype, parent) {
|
|||
this.is_editable = {};
|
||||
this.opendocs = {};
|
||||
this.sections = [];
|
||||
this.sections_by_label = {};
|
||||
this.section_count;
|
||||
this.grids = [];
|
||||
this.cscript = {};
|
||||
this.pformat = {};
|
||||
|
|
@ -354,8 +352,10 @@ _f.Frm.prototype.setup_fields_std = function() {
|
|||
sec.fields.push(fld);
|
||||
}
|
||||
|
||||
if(f.fieldtype=='Section Break' && f.options != 'Simple')
|
||||
if(f.fieldtype=='Section Break') {
|
||||
sec = fld;
|
||||
this.sections.push(fld);
|
||||
}
|
||||
|
||||
// default col-break after sec-break
|
||||
if((f.fieldtype=='Section Break')&&(fl[i+1])&&(fl[i+1].fieldtype!='Column Break')&&!f.hidden) {
|
||||
|
|
@ -657,7 +657,7 @@ _f.Frm.prototype.refresh_footer = function() {
|
|||
// --------------------------------------------------------------------------------------
|
||||
|
||||
_f.Frm.prototype.refresh_fields = function() {
|
||||
// set fields
|
||||
// refresh fields
|
||||
for(var i=0; i<this.fields.length; i++) {
|
||||
var f = this.fields[i];
|
||||
f.perm = this.perm;
|
||||
|
|
@ -668,10 +668,17 @@ _f.Frm.prototype.refresh_fields = function() {
|
|||
var fn = f.df.fieldname || f.df.label;
|
||||
if(fn)
|
||||
f.df = get_field(this.doctype, fn, this.docname);
|
||||
if(f.refresh)
|
||||
f.refresh();
|
||||
|
||||
if(f.df.fieldtype!='Section Break' && f.refresh) {
|
||||
f.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
// refresh sections
|
||||
$.each(this.sections, function(i, f) {
|
||||
f.refresh();
|
||||
})
|
||||
|
||||
// cleanup activities after refresh
|
||||
this.cleanup_refresh(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ _f.SectionBreak.prototype.has_data = function() {
|
|||
var me = this;
|
||||
for(var i in me.fields) {
|
||||
var f = me.fields[i];
|
||||
var v = f.df.get_value ? f.df.get_value() : null;
|
||||
var v = f.get_value ? f.get_value() : null;
|
||||
|
||||
// value that is not default
|
||||
defaultval = f.df['default'] || sys_defaults[f.fieldname] || user_defaults[f.fieldname];
|
||||
|
|
@ -141,13 +141,13 @@ _f.SectionBreak.prototype.has_data = function() {
|
|||
}
|
||||
|
||||
// unfilled mandatory field
|
||||
if(!v && f.df.reqd) {
|
||||
if(f.df.reqd && !v) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// filled table
|
||||
if(f.df.fieldtype=='Table') {
|
||||
if(f.grid.get_children.length || f.df.reqd) {
|
||||
if(f.grid.get_children().length || f.df.reqd) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue