Save request is sent to server despite fields marked with error

If the screen contains errors, the client shouldn’t send save request to the server.

The screen is full of red exclamation marks, so the client should be aware, that there are errors in the data, but still sends save request to the server.

1 Like

Yes, it should know and not even try. Anyway, when it does, it still receives a correct error message, is that right?

When it does, the server invokes possible validation rules. Those might fail if they are based on the assumption that all mandatory fields are filled.

I’ve checked the network and server returns 422 code and then client shows the expected error message “not all mandatory fields are filled”.

So what should happen? Show a generic error message (something like there are errors in the screen…)? Or show all errors in the screen in a pop up window?

If there are any errors (exclamation marks in UI, errors in row states), the client should raise an error message - there’s already message in the system - “not all mandatory fields are filled…”

Do you mean it was in the flash client’s localization file?

I mean this warning:

I think this is a server message. So not really possible to use directly from js code. Am I right? Then we will need to copy this including the translations to the client code as well.

Is there really an issue with the client sending the request to the server? I don’t see a big problem in it actually. It would save us a small roundtrip, ok, but nothing really expensive. Nothing would change from the user’s perspective. The error message would stay exactly the same.

It is not a server message. Server response contains only a stack trace of the exception.

It becomes a problem when you have validation rules in place. They’re applied before the mandatory fields checks, so you need to design them with this fact in mind.

Then I suggest that the rules get evaluated after the mandatory field checks. I think it is an error that it doesn’t do it.

I’m still not convinced, that if the client knows that the data are in error state to send them to the server. It consumes resources and it will cause an exception, which is expensive per se.

As the final argument, I’ve checked the code of the Flash client and the Flash client didn’t send save request if the data were in the error state.

That is true. But checking the flag that we have errors is very cheap. So I do not see it as such a big issue.

One way or another, the server should not crash even if the client does not know what to do. Imagine an independent API user. The server has to check the rules after the mandatory fields checks.

The error message is in the server. But I’m not sure we can copy it and use as is. It says that some fileds are empty, but the client does know that.
Not sending the request is not a big deal from the clients’t perspective but we should modify the message:
“Form data contain errors. Correct these errors before proceeding.”

The exclamation marks always mean mandatory fields. So it is important to say it. This part of a message was added after the user feedback that they did not understand what errors were meant.

I would suggest to leave this message on the server, just fixing the order of rule evaluation. So there is only one version of the message, less code.

OK, this solution is fine with me.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.