Commit 19ed21eb authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add required events on handsontable

parent d7bc12b4
......@@ -342,12 +342,23 @@
var __check_required = function() {
var condition_raised = _check_condition_raised(conditions_params, which);
var param_name = param_input.selector.substr(1);
if (condition_raised) {
param_input.rules("add", {"required": true});
if (param_name.indexOf("___") == -1) {
param_input.rules("add", {"required": true});
}
else {
handsontables[param_name.split("___")[0]].allRequired[param_name] = true;
}
}
else {
param_input.rules("remove", "required");
param_input.valid();
if (param_name.indexOf("___") == -1) {
param_input.rules("remove", "required");
param_input.valid();
}
else {
handsontables[param_name.split("___")[0]].allRequired[param_name] = false;
}
}
}
......
......@@ -221,6 +221,8 @@ jQuery.validator.addMethod("mparam", function(value, element, params) {
return true;
});
var handsontables = {};
// handle bootstrap datepicker with handsontable
(function (Handsontable) {
var BootstrapDateEditor = Handsontable.editors.TextEditor.prototype.extend();
......@@ -786,8 +788,6 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
$("#workflow_form").validate({ rules: rules });
var params = JflowWfformRules.check_parameters_rules($this.workflow.parameters, $this);
// handle inputfile
$("a[class^=inputfile_]").click(function(){
$("#"+$(this).attr("class")).html($(this).html());
......@@ -943,6 +943,9 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
allActions = {},
allRequired = {},
allHelps = {};
handsontables[param_name] = $.extend($(this), {
allRequired: allRequired
});
allHelps[param_name] = params_per_name[param_name].help;
for (var i in params_per_name[param_name].sub_parameters) {
dataSchema[params_per_name[param_name].sub_parameters[i].name] = null;
......@@ -1184,6 +1187,8 @@ Handsontable.cellTypes["bootdate"] = Handsontable.BootstrapDateCell;
if ($this.options.displayResetButton) {
$("#wfform_reset_btn").click(function() { $this.reset(); })
}
var params = JflowWfformRules.check_parameters_rules($this.workflow.parameters, $this);
}
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment