return to the incomplete input when submit script
return to the incomplete input when submit script
This commit is contained in:
parent
270c4b8d14
commit
bc164c3ece
|
@ -325,6 +325,10 @@ function Behavior(usePlugin, containerId) {
|
|||
"behavior_usePlugin", "batch"));
|
||||
|
||||
}
|
||||
|
||||
this.getBehaviorEditorMap = function(){
|
||||
return behaviorEditorMap;
|
||||
}
|
||||
|
||||
this.getPages = function() {
|
||||
updateBehaviorEditors();
|
||||
|
|
|
@ -16,24 +16,48 @@ $(function() {
|
|||
});
|
||||
});
|
||||
|
||||
function checkPluginsInput(plugins) {
|
||||
function checkPluginsInput(plugins, usePlugin) {
|
||||
|
||||
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;
|
||||
if (plugins[i].parameters[j].check =="false"){
|
||||
$("#tabs").tabs("option", "active", 0 );
|
||||
|
||||
var usePluginEditorMap = usePlugin.getUsePluginEditorMap();
|
||||
$("#pluginEditor").append(usePluginEditorMap.get(plugins[i].id));
|
||||
var inputs = $("#"+ plugins[i].parameters[j].key + " input");
|
||||
for (var p = 0; p < inputs.length; p++){
|
||||
if ($(inputs[p]).val() == ""){
|
||||
$(inputs[p]).focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkPagesInput(pages) {
|
||||
function checkPagesInput(pages, usePlugin) {
|
||||
|
||||
for (var i = 0;i < pages.length; i++){
|
||||
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;
|
||||
}
|
||||
if (pages[i].batches[j].behaviors[k].parameters[q].check =="false"){
|
||||
$("#tabs").tabs("option", "active", 1 );
|
||||
var behaviorEditorMap = usePlugin.getBehaviorEditorMap();
|
||||
$("#behaviorEditor").append(behaviorEditorMap.get(pages[i].batches[j].behaviors[k].id));
|
||||
var inputs = $("#"+ pages[i].batches[j].behaviors[k].parameters[q].key + " input");
|
||||
for (var p = 0; p < inputs.length; p++){
|
||||
if ($(inputs[p]).val() == ""){
|
||||
$(inputs[p]).focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,12 @@ $(function() {
|
|||
|
||||
$("#submitScript").click(function() {
|
||||
var formData = new FormData();
|
||||
var plugins = usePlugin.getPlugins( formData );
|
||||
var plugins = usePlugin.getPlugins(formData);
|
||||
var pages = usePlugin.getPages();
|
||||
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
||||
if(checkPluginsInput(plugins, usePlugin) && checkPagesInput(pages, usePlugin))
|
||||
submitScript(pages, plugins, formData);
|
||||
else
|
||||
else{
|
||||
information("Please complete the required parameters.");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ $(function() {
|
|||
var formData = new FormData();
|
||||
var plugins = usePlugin.getPlugins(formData);
|
||||
var pages = usePlugin.getPages();
|
||||
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
||||
if(checkPluginsInput(plugins, usePlugin) && checkPagesInput(pages, usePlugin))
|
||||
updateScript(scriptId,pages,plugins,formData);
|
||||
else
|
||||
information("Please complete the required parameters.");
|
||||
|
|
|
@ -85,6 +85,11 @@ function UsePlugin(behaviorListContainerId) {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
this.getUsePluginEditorMap = function() {
|
||||
return usePluginEditorMap;
|
||||
}
|
||||
|
||||
function getPluginList() {
|
||||
var usePlugin = this;
|
||||
$.post("loadPluginName", {}, function(data) {
|
||||
|
@ -197,6 +202,10 @@ function UsePlugin(behaviorListContainerId) {
|
|||
return behavior.getPages();
|
||||
}
|
||||
|
||||
this.getBehaviorEditorMap = function(){
|
||||
return behavior.getBehaviorEditorMap();
|
||||
}
|
||||
|
||||
this.initPluginAndPages = function(scriptObj){
|
||||
initPluginList(scriptObj.usePlugins);
|
||||
behavior.initBehaviorList(scriptObj.pages);
|
||||
|
|
Loading…
Reference in New Issue