mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Etemplate: switch to tab of first invalid input, not last
This commit is contained in:
parent
47c7570862
commit
d367da6ba8
@ -675,9 +675,13 @@ var etemplate2 = /** @class */ (function () {
|
|||||||
var values = this.getValues(container);
|
var values = this.getValues(container);
|
||||||
// Trigger the submit event
|
// Trigger the submit event
|
||||||
var canSubmit = true;
|
var canSubmit = true;
|
||||||
|
var invalid = null;
|
||||||
if (!no_validation) {
|
if (!no_validation) {
|
||||||
container.iterateOver(function (_widget) {
|
container.iterateOver(function (_widget) {
|
||||||
if (_widget.submit(values) === false) {
|
if (_widget.submit(values) === false) {
|
||||||
|
if (!invalid && !_widget.isValid()) {
|
||||||
|
invalid = _widget;
|
||||||
|
}
|
||||||
canSubmit = false;
|
canSubmit = false;
|
||||||
}
|
}
|
||||||
}, this, et2_ISubmitListener);
|
}, this, et2_ISubmitListener);
|
||||||
@ -704,6 +708,12 @@ var etemplate2 = /** @class */ (function () {
|
|||||||
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (invalid !== null) {
|
||||||
|
// Show the first invalid widget, not the last
|
||||||
|
var messages = [];
|
||||||
|
var valid = invalid.isValid(messages);
|
||||||
|
invalid.set_validation_error(messages);
|
||||||
|
}
|
||||||
return canSubmit;
|
return canSubmit;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -858,12 +858,17 @@ export class etemplate2
|
|||||||
|
|
||||||
// Trigger the submit event
|
// Trigger the submit event
|
||||||
let canSubmit = true;
|
let canSubmit = true;
|
||||||
|
let invalid = null;
|
||||||
if (!no_validation)
|
if (!no_validation)
|
||||||
{
|
{
|
||||||
container.iterateOver(function (_widget)
|
container.iterateOver(function (_widget)
|
||||||
{
|
{
|
||||||
if (_widget.submit(values) === false)
|
if (_widget.submit(values) === false)
|
||||||
{
|
{
|
||||||
|
if(!invalid && !_widget.isValid())
|
||||||
|
{
|
||||||
|
invalid = _widget;
|
||||||
|
}
|
||||||
canSubmit = false;
|
canSubmit = false;
|
||||||
}
|
}
|
||||||
}, this, et2_ISubmitListener);
|
}, this, et2_ISubmitListener);
|
||||||
@ -900,6 +905,13 @@ export class etemplate2
|
|||||||
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
this._widgetContainer.egw().debug("warn", "Missing menuaction for submit. Values: ", values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (invalid !== null)
|
||||||
|
{
|
||||||
|
// Show the first invalid widget, not the last
|
||||||
|
let messages = [];
|
||||||
|
let valid = invalid.isValid(messages);
|
||||||
|
invalid.set_validation_error(messages);
|
||||||
|
}
|
||||||
return canSubmit;
|
return canSubmit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user