add input content verification
add input content verification
This commit is contained in:
parent
c938d5734b
commit
28965ed380
|
@ -3,7 +3,7 @@
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property>
|
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property>
|
||||||
<property name="hibernate.connection.url"> jdbc:mysql://localhost:3306/bench4q_master
|
<property name="hibernate.connection.url"> jdbc:mysql://133.133.133.36:3306/bench4q_master
|
||||||
</property>
|
</property>
|
||||||
<property name="hibernate.connection.username">root</property>
|
<property name="hibernate.connection.username">root</property>
|
||||||
<property name="hibernate.connection.password">123456 </property>
|
<property name="hibernate.connection.password">123456 </property>
|
||||||
|
|
|
@ -1,5 +1,38 @@
|
||||||
$(document).ready(function(){
|
$(function() {
|
||||||
$("#behaviorEditor").on("focusout",".editor input",function(){
|
$(document).ready(function(){
|
||||||
console.log(this);
|
$("#behaviorEditor").on("focusout",".editor input",function(){
|
||||||
})
|
var input = $(this);
|
||||||
|
if(input.attr("required") == "required" && input.val() == ""){
|
||||||
|
information("Please fill in the parameter");
|
||||||
|
input.focus();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkPluginsInput(plugins) {
|
||||||
|
for (var i = 0; i < plugins.length; i++){
|
||||||
|
for (var j = 0; j < plugins[i].parameters.length; j++){
|
||||||
|
if (plugins[i].parameters[j].check =="false")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPagesInput(pages) {
|
||||||
|
for (var i = 0;i < pages.length; i++){
|
||||||
|
console.log(pages[i].batches.length);
|
||||||
|
for (var j = 0; j < pages[i].batches.length; j++){
|
||||||
|
for (var k = 0; k < pages[i].batches[j].behaviors.length; k++){
|
||||||
|
for (var q = 0; q < pages[i].batches[j].behaviors[k].parameters.length; q++){
|
||||||
|
if (pages[i].batches[j].behaviors[k].parameters[q].check == "false"){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -6,6 +6,9 @@ $(function() {
|
||||||
$("#submitScript").click(function() {
|
$("#submitScript").click(function() {
|
||||||
var plugins = usePlugin.getPlugins();
|
var plugins = usePlugin.getPlugins();
|
||||||
var pages = usePlugin.getPages();
|
var pages = usePlugin.getPages();
|
||||||
submitScript(pages,plugins);
|
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
||||||
|
submitScript(pages,plugins);
|
||||||
|
else
|
||||||
|
information("必填的参数没有填写完整,请补充完整后提交");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
var Parameter = function(key, value) {
|
var Parameter = function(key, value, check) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
if (check == undefined)
|
||||||
|
this.check = "true";
|
||||||
|
else
|
||||||
|
this.check = check;
|
||||||
|
|
||||||
}
|
}
|
||||||
var DataCollector = function() {
|
var DataCollector = function() {
|
||||||
};
|
};
|
||||||
|
@ -17,7 +22,11 @@ DataCollector.prototype.checkBoxData = function(editor) {
|
||||||
var choice = editor.find("input[type='checkbox']");
|
var choice = editor.find("input[type='checkbox']");
|
||||||
var value = choice.is(':checked');
|
var value = choice.is(':checked');
|
||||||
|
|
||||||
return new Parameter(name, value);
|
var required = editor.children("input").attr("required");
|
||||||
|
var check = "true";
|
||||||
|
if (required == "required" && value == "")
|
||||||
|
check = "false";
|
||||||
|
return new Parameter(name, value, check);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataCollector.prototype.fieldData = function(editor) {
|
DataCollector.prototype.fieldData = function(editor) {
|
||||||
|
@ -28,7 +37,11 @@ DataCollector.prototype.fieldData = function(editor) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return new Parameter(name, value);
|
var required = editor.children("input").attr("required");
|
||||||
|
var check = "true";
|
||||||
|
if (required == "required" && value == "")
|
||||||
|
check = "false";
|
||||||
|
return new Parameter(name, value, check);
|
||||||
};
|
};
|
||||||
DataCollector.prototype.dateData = function(editor) {
|
DataCollector.prototype.dateData = function(editor) {
|
||||||
var name = editor.attr("id");
|
var name = editor.attr("id");
|
||||||
|
@ -36,7 +49,11 @@ DataCollector.prototype.dateData = function(editor) {
|
||||||
// if (!this.validate(value)) {
|
// if (!this.validate(value)) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
return new Parameter(name, value);
|
var required = editor.children("input").attr("required");
|
||||||
|
var check = "true";
|
||||||
|
if (required == "required" && value == "")
|
||||||
|
check = "false";
|
||||||
|
return new Parameter(name, value, check);
|
||||||
};
|
};
|
||||||
DataCollector.prototype.multiFieldData = function(editor) {
|
DataCollector.prototype.multiFieldData = function(editor) {
|
||||||
var editorArray = editor.children(".field");
|
var editorArray = editor.children(".field");
|
||||||
|
@ -47,9 +64,13 @@ DataCollector.prototype.multiFieldData = function(editor) {
|
||||||
}
|
}
|
||||||
var name = editor.attr("id")
|
var name = editor.attr("id")
|
||||||
var value = "";
|
var value = "";
|
||||||
|
var check = "true"
|
||||||
for ( var i = 0; i < editorArray.length; i++) {
|
for ( var i = 0; i < editorArray.length; i++) {
|
||||||
var fieldValue = $(editorArray[i]).children("input").val();
|
var fieldValue = $(editorArray[i]).children("input").val();
|
||||||
|
var tmpRequired = $(editorArray[i]).children("input").attr("required");
|
||||||
|
if (tmpRequired =="required" && fieldValue == ""){
|
||||||
|
check = "false";
|
||||||
|
}
|
||||||
if (fieldValue == "") {
|
if (fieldValue == "") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +81,7 @@ DataCollector.prototype.multiFieldData = function(editor) {
|
||||||
// if (!this.validate(value)) {
|
// if (!this.validate(value)) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
return new Parameter(name, value);
|
return new Parameter(name, value, check);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,10 +90,15 @@ DataCollector.prototype.tableData = function(editor) {
|
||||||
var editorArray = editor.find("tbody").children("tr");
|
var editorArray = editor.find("tbody").children("tr");
|
||||||
var name = editor.attr("id");
|
var name = editor.attr("id");
|
||||||
var value = "";
|
var value = "";
|
||||||
|
var check = "true";
|
||||||
for ( var i = 0; i < editorArray.length; i++) {
|
for ( var i = 0; i < editorArray.length; i++) {
|
||||||
var tdArray = $(editorArray[i]).children("td");
|
var tdArray = $(editorArray[i]).children("td");
|
||||||
var trValue = "";
|
var trValue = "";
|
||||||
for ( var j = 0; j < tdArray.length; j++) {
|
for ( var j = 0; j < tdArray.length; j++) {
|
||||||
|
var tmpRequired = $(tdArray[j]).children("input").attr("required");
|
||||||
|
var tmpValue = $(tdArray[j]).children("input").val();
|
||||||
|
if (tmpRequired == "Required" && tmpValue == "")
|
||||||
|
check = "false";
|
||||||
if ($(tdArray[j]).children("input").val() == undefined
|
if ($(tdArray[j]).children("input").val() == undefined
|
||||||
|| $(tdArray[j]).children("input").val() == "") {
|
|| $(tdArray[j]).children("input").val() == "") {
|
||||||
continue;
|
continue;
|
||||||
|
@ -88,7 +114,7 @@ DataCollector.prototype.tableData = function(editor) {
|
||||||
// if (!this.validate(value)) {
|
// if (!this.validate(value)) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
return new Parameter(name, value);
|
return new Parameter(name, value, check);
|
||||||
|
|
||||||
};
|
};
|
||||||
DataCollector.prototype.selectData = function(editor) {
|
DataCollector.prototype.selectData = function(editor) {
|
||||||
|
|
|
@ -227,7 +227,7 @@ function(label, name, required, cols, id, value) {
|
||||||
$(input).attr("type", "text");
|
$(input).attr("type", "text");
|
||||||
$(input).attr("style","width:"+"90%");
|
$(input).attr("style","width:"+"90%");
|
||||||
if(required == "true"){
|
if(required == "true"){
|
||||||
$(field).attr("required", "required");
|
$(input).attr("required", "required");
|
||||||
}
|
}
|
||||||
if(values[i] != undefined){
|
if(values[i] != undefined){
|
||||||
$(input).val(values[i].split("=")[1]);
|
$(input).val(values[i].split("=")[1]);
|
||||||
|
@ -280,7 +280,7 @@ EditorFactory.prototype.createDate = function(label, name, required, size, id, v
|
||||||
var date = document.createElement("input");
|
var date = document.createElement("input");
|
||||||
$(date).attr("type", "date");
|
$(date).attr("type", "date");
|
||||||
if(required == "true"){
|
if(required == "true"){
|
||||||
$(field).attr("required", "required");
|
$(date).attr("required", "required");
|
||||||
}
|
}
|
||||||
$(div).children(".editor").append(dateLabel);
|
$(div).children(".editor").append(dateLabel);
|
||||||
$(div).children(".editor").append(date);
|
$(div).children(".editor").append(date);
|
||||||
|
|
|
@ -36,7 +36,10 @@ $(function() {
|
||||||
$("#submitScript").click(function() {
|
$("#submitScript").click(function() {
|
||||||
var plugins = usePlugin.getPlugins();
|
var plugins = usePlugin.getPlugins();
|
||||||
var pages = usePlugin.getPages();
|
var pages = usePlugin.getPages();
|
||||||
updateScript(scriptId,pages,plugins);
|
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
||||||
|
updateScript(scriptId,pages,plugins);
|
||||||
|
else
|
||||||
|
information("必填的参数没有填写完整,请补充完整后提交");
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue