Add the correct task from the button clicked. Not be the best solution but solved the problem. Looking for a more correct solution later.

This commit is contained in:
Flavio Copes
2015-08-19 17:27:34 +02:00
parent c2a54b3770
commit a27ee216dd

View File

@@ -2,6 +2,11 @@
var root = window || {};
root = root.GravJS = root.GravJS || {};
root.clickedButton = null;
$(document).on('click', 'button.task', function(e) {
root.clickedButton = e.target;
});
function addTypes (form, factory) {
var name = factory.getName(),
types = factory.getTypes();
@@ -296,6 +301,13 @@
$.extend(values, this.getValues());
if ($(root.clickedButton).attr('name') == 'task') {
values.task = $(root.clickedButton).attr('value');
if (values.task == 'saveas') {
values.lang = $(root.clickedButton).attr('lang');
}
}
if (!values.task) {
values.task = 'save';
}