mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +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);
|
||||
// Trigger the submit event
|
||||
var canSubmit = true;
|
||||
var invalid = null;
|
||||
if (!no_validation) {
|
||||
container.iterateOver(function (_widget) {
|
||||
if (_widget.submit(values) === false) {
|
||||
if (!invalid && !_widget.isValid()) {
|
||||
invalid = _widget;
|
||||
}
|
||||
canSubmit = false;
|
||||
}
|
||||
}, this, et2_ISubmitListener);
|
||||
@ -704,6 +708,12 @@ var etemplate2 = /** @class */ (function () {
|
||||
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;
|
||||
};
|
||||
/**
|
||||
|
@ -858,12 +858,17 @@ export class etemplate2
|
||||
|
||||
// Trigger the submit event
|
||||
let canSubmit = true;
|
||||
let invalid = null;
|
||||
if (!no_validation)
|
||||
{
|
||||
container.iterateOver(function (_widget)
|
||||
{
|
||||
if (_widget.submit(values) === false)
|
||||
{
|
||||
if(!invalid && !_widget.isValid())
|
||||
{
|
||||
invalid = _widget;
|
||||
}
|
||||
canSubmit = false;
|
||||
}
|
||||
}, this, et2_ISubmitListener);
|
||||
@ -900,6 +905,13 @@ export class etemplate2
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user