parent
fccd5d0a27
commit
9fc76cf05e
|
@ -1,15 +1,17 @@
|
|||
var EditorFactory = function() {
|
||||
};
|
||||
|
||||
EditorFactory.prototype.createBaseEditor = function(label, id) {
|
||||
EditorFactory.prototype.createBaseEditor = function(label, id, required) {
|
||||
if (label == null) {
|
||||
label = "";
|
||||
}
|
||||
var containerBox = document.createElement("div");
|
||||
$(containerBox).addClass("containerBox");
|
||||
var boxHeader = document.createElement("div");
|
||||
var p = document.createElement("p")
|
||||
$(p).html(label)
|
||||
var p = document.createElement("p");
|
||||
if (required == "true")
|
||||
label = label + "   (required)";
|
||||
$(p).html(label);
|
||||
$(boxHeader).append(p);
|
||||
$(boxHeader).addClass("containerHeader")
|
||||
$(containerBox).append(boxHeader);
|
||||
|
@ -51,7 +53,7 @@ EditorFactory.prototype.createChoice = function(value, defaultValue, name,
|
|||
}
|
||||
|
||||
EditorFactory.prototype.createField = function(label, name, required, size, id, value) {
|
||||
var div = this.createBaseEditor(label, id);
|
||||
var div = this.createBaseEditor(label, id, required);
|
||||
$(div).children(".editor").attr("editorType", "field");
|
||||
$(div).children(".editor").append(this.createFieldLine(size, name, required, value));
|
||||
return div;
|
||||
|
@ -59,7 +61,7 @@ EditorFactory.prototype.createField = function(label, name, required, size, id,
|
|||
|
||||
EditorFactory.prototype.createMultiField = function(label, name, required, size, id,
|
||||
value) {
|
||||
var div = this.createBaseEditor(label, id);
|
||||
var div = this.createBaseEditor(label, id, required);
|
||||
$(div).children(".editor").attr("editorType", "multiField");
|
||||
if (value != null) {
|
||||
var values = value.split(";");
|
||||
|
@ -101,7 +103,7 @@ EditorFactory.prototype.createFieldLine = function(size, name, required, value)
|
|||
$(fieldName).html(name);
|
||||
var field = document.createElement("input");
|
||||
$(field).attr("type", "text");
|
||||
if(required=="true"){
|
||||
if(required == "true"){
|
||||
$(field).attr("required", "required");
|
||||
}
|
||||
// $(field).attr("maxlength", size);
|
||||
|
@ -114,7 +116,7 @@ EditorFactory.prototype.createFile = function(label, name, required, size, id, v
|
|||
size = 150;
|
||||
}
|
||||
|
||||
var div = this.createBaseEditor(label, id);
|
||||
var div = this.createBaseEditor(label, id, required);
|
||||
$(div).children(".editor").attr("editorType", "file");
|
||||
var fileEditor = document.createElement("div");
|
||||
|
||||
|
@ -142,7 +144,7 @@ EditorFactory.prototype.createTable = /**
|
|||
*/
|
||||
function(label, name, required, cols, id, value) {
|
||||
|
||||
var div = this.createBaseEditor(label, id);
|
||||
var div = this.createBaseEditor(label, id, required);
|
||||
$(div).children(".editor").attr("editorType", "table");
|
||||
var headers = getHeaders(cols);
|
||||
|
||||
|
@ -273,7 +275,7 @@ EditorFactory.prototype.createDate = function(label, name, required, size, id, v
|
|||
if (size == null || size < 0) {
|
||||
size = 150
|
||||
}
|
||||
var div = this.createBaseEditor(label, id);
|
||||
var div = this.createBaseEditor(label, id, required);
|
||||
$(div).children(".editor").attr("editorType", "date");
|
||||
var dateLabel = document.createElement("label");
|
||||
$(dateLabel).html(name);
|
||||
|
|
Loading…
Reference in New Issue