forked from extern/egroupware
Etemplate: switch to tab of first invalid input, not last
This commit is contained in:
parent
9b427f57fc
commit
9376cb295f
@ -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