Skip to content

Commit f48d53a

Browse files
committed
Fix bugs with error messages not showing up. Fixes #114
1 parent f8133b1 commit f48d53a

File tree

7 files changed

+30
-28
lines changed

7 files changed

+30
-28
lines changed

dist/jsoneditor.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! JSON Editor v0.6.8 - JSON Schema -> HTML Editor
1+
/*! JSON Editor v0.6.9 - JSON Schema -> HTML Editor
22
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
33
* Released under the MIT license
44
*
5-
* Date: 2014-05-09
5+
* Date: 2014-05-23
66
*/
77

88
/**
@@ -179,12 +179,12 @@ JSONEditor.prototype = {
179179
// Starting data
180180
if(self.options.startval) self.root.setValue(self.options.startval);
181181

182-
self.validation_results = self.validator.validate(self.root.getValue());
183-
self.root.showValidationErrors(self.validation_results);
184182
self.ready = true;
185183

186184
// Fire ready event asynchronously
187185
requestAnimationFrame(function() {
186+
self.validation_results = self.validator.validate(self.root.getValue());
187+
self.root.showValidationErrors(self.validation_results);
188188
self.trigger('ready');
189189
self.trigger('change');
190190
});
@@ -199,7 +199,6 @@ JSONEditor.prototype = {
199199
if(!this.ready) throw "JSON Editor not ready yet. Listen for 'ready' event before setting the value";
200200

201201
this.root.setValue(value);
202-
this.validation_results = this.validator.validate(this.root.getValue());
203202
return this;
204203
},
205204
validate: function(value) {
@@ -267,7 +266,7 @@ JSONEditor.prototype = {
267266
this.callbacks[event][i]();
268267
}
269268
}
270-
},
269+
},
271270
getEditorClass: function(schema, editor) {
272271
var classname;
273272

@@ -342,7 +341,7 @@ JSONEditor.prototype = {
342341
uuid = this.uuid++;
343342
el.setAttribute('data-jsoneditor-'+key,uuid);
344343
}
345-
344+
346345
this.__data[uuid] = value;
347346
}
348347
// Getting data
@@ -367,7 +366,7 @@ JSONEditor.prototype = {
367366
if(!this.editors) return;
368367
return this.editors[path];
369368
},
370-
watch: function(path,callback) {
369+
watch: function(path,callback) {
371370
this.watchlist = this.watchlist || {};
372371
this.watchlist[path] = this.watchlist[path] || [];
373372
this.watchlist[path].push(callback);
@@ -5110,6 +5109,7 @@ JSONEditor.AbstractTheme = Class.extend({
51105109
},
51115110
getFormControl: function(label, input, description) {
51125111
var el = document.createElement('div');
5112+
el.className = 'form-control';
51135113
if(label) el.appendChild(label);
51145114
if(input.type === 'checkbox') {
51155115
label.insertBefore(input,label.firstChild);
@@ -5149,7 +5149,7 @@ JSONEditor.AbstractTheme = Class.extend({
51495149
getButtonHolder: function() {
51505150
return document.createElement('div');
51515151
},
5152-
getButton: function(text, icon, title) {
5152+
getButton: function(text, icon, title) {
51535153
var el = document.createElement('button');
51545154
this.setButtonText(el,text,icon,title);
51555155
return el;
@@ -5329,7 +5329,7 @@ JSONEditor.defaults.themes.bootstrap2 = JSONEditor.AbstractTheme.extend({
53295329
afterInputReady: function(input) {
53305330
if(input.controlgroup) return;
53315331
input.controlgroup = this.closest(input,'.control-group');
5332-
input.controls = this.closest(input,'controls');
5332+
input.controls = this.closest(input,'.controls');
53335333
if(this.closest(input,'.compact')) {
53345334
input.controlgroup.className = input.controlgroup.className.replace(/control-group/g,'').replace(/[ ]{2,}/g,' ');
53355335
input.controls.className = input.controlgroup.className.replace(/controls/g,'').replace(/[ ]{2,}/g,' ');
@@ -5590,7 +5590,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
55905590
var el = document.createElement('div');
55915591
el.style.marginBottom = '15px';
55925592
return el;
5593-
},
5593+
},
55945594
getSelectInput: function(options) {
55955595
var el = this._super(options);
55965596
el.style.minWidth = 'none';
@@ -5665,6 +5665,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
56655665
},
56665666
removeInputError: function(input) {
56675667
if(!input.errmsg) return;
5668+
input.group.className = input.group.className.replace(/ error/g,'');
56685669
input.errmsg.style.display = 'none';
56695670
}
56705671
});

dist/jsoneditor.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ JSONEditor.prototype = {
4949
// Starting data
5050
if(self.options.startval) self.root.setValue(self.options.startval);
5151

52-
self.validation_results = self.validator.validate(self.root.getValue());
53-
self.root.showValidationErrors(self.validation_results);
5452
self.ready = true;
5553

5654
// Fire ready event asynchronously
5755
requestAnimationFrame(function() {
56+
self.validation_results = self.validator.validate(self.root.getValue());
57+
self.root.showValidationErrors(self.validation_results);
5858
self.trigger('ready');
5959
self.trigger('change');
6060
});
@@ -69,7 +69,6 @@ JSONEditor.prototype = {
6969
if(!this.ready) throw "JSON Editor not ready yet. Listen for 'ready' event before setting the value";
7070

7171
this.root.setValue(value);
72-
this.validation_results = this.validator.validate(this.root.getValue());
7372
return this;
7473
},
7574
validate: function(value) {
@@ -137,7 +136,7 @@ JSONEditor.prototype = {
137136
this.callbacks[event][i]();
138137
}
139138
}
140-
},
139+
},
141140
getEditorClass: function(schema, editor) {
142141
var classname;
143142

@@ -212,7 +211,7 @@ JSONEditor.prototype = {
212211
uuid = this.uuid++;
213212
el.setAttribute('data-jsoneditor-'+key,uuid);
214213
}
215-
214+
216215
this.__data[uuid] = value;
217216
}
218217
// Getting data
@@ -237,7 +236,7 @@ JSONEditor.prototype = {
237236
if(!this.editors) return;
238237
return this.editors[path];
239238
},
240-
watch: function(path,callback) {
239+
watch: function(path,callback) {
241240
this.watchlist = this.watchlist || {};
242241
this.watchlist[path] = this.watchlist[path] || [];
243242
this.watchlist[path].push(callback);

src/intro.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! JSON Editor v0.6.8 - JSON Schema -> HTML Editor
1+
/*! JSON Editor v0.6.9 - JSON Schema -> HTML Editor
22
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
33
* Released under the MIT license
44
*
5-
* Date: 2014-05-09
5+
* Date: 2014-05-23
66
*/
77

88
/**

src/theme.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ JSONEditor.AbstractTheme = Class.extend({
132132
},
133133
getFormControl: function(label, input, description) {
134134
var el = document.createElement('div');
135+
el.className = 'form-control';
135136
if(label) el.appendChild(label);
136137
if(input.type === 'checkbox') {
137138
label.insertBefore(input,label.firstChild);
@@ -171,7 +172,7 @@ JSONEditor.AbstractTheme = Class.extend({
171172
getButtonHolder: function() {
172173
return document.createElement('div');
173174
},
174-
getButton: function(text, icon, title) {
175+
getButton: function(text, icon, title) {
175176
var el = document.createElement('button');
176177
this.setButtonText(el,text,icon,title);
177178
return el;

src/themes/bootstrap2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ JSONEditor.defaults.themes.bootstrap2 = JSONEditor.AbstractTheme.extend({
3636
afterInputReady: function(input) {
3737
if(input.controlgroup) return;
3838
input.controlgroup = this.closest(input,'.control-group');
39-
input.controls = this.closest(input,'controls');
39+
input.controls = this.closest(input,'.controls');
4040
if(this.closest(input,'.compact')) {
4141
input.controlgroup.className = input.controlgroup.className.replace(/control-group/g,'').replace(/[ ]{2,}/g,' ');
4242
input.controls.className = input.controlgroup.className.replace(/controls/g,'').replace(/[ ]{2,}/g,' ');

src/themes/foundation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
44
var el = document.createElement('div');
55
el.style.marginBottom = '15px';
66
return el;
7-
},
7+
},
88
getSelectInput: function(options) {
99
var el = this._super(options);
1010
el.style.minWidth = 'none';
@@ -79,6 +79,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
7979
},
8080
removeInputError: function(input) {
8181
if(!input.errmsg) return;
82+
input.group.className = input.group.className.replace(/ error/g,'');
8283
input.errmsg.style.display = 'none';
8384
}
8485
});

0 commit comments

Comments
 (0)