4 weeks ago
Hi guys,
I have a bound action in my sap cap project where I check for mandatory fields and throw errors highlighting the targets in the UI, in a Fiori Elements Object page.
if (mandatoryFields.length) {
for (const field of mandatoryFields) {
if (!item[field.mandatoryField]) {
req.error({
message: `The field ${field.description} is mandatory`,
target: `in/${field.mandatoryField}`,
code: 400,
});
}
};
};
My problem here is that it is showing the error in the UI in a MessageBox but not highlighting the targets. I have the exact same code inside a this.on("SAVE") action and it works there, but somehow it doesn't inside a bound action.
The only solution I found is returning the req.error, but then it only shows it one by one and feels very clumsy.
I would appreciate any help with this issue. Thanks!
A few thoughts:
1. Are you 100% sure that the req.error calls occurs? i.e. Your logic isn't preventing it from getting invoked?
2. Does this syntax work?
req.error(400,`The field ${field.description} is mandatory`, `in/${field.mandatoryField}`)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
12 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.