-
Is it possible to have a view handle errors from the response to an ActionForm? I would like to create some forms that update with feedback to the user when there is an error from the server. I tested the session_auth_axum example and it looks like the there is some intention to show login errors in the header but the error message never seems to show:
When I log in using an invalid username or password, I see the 500 error is returned to the browser with a body like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yep so there are a handful of different things here:
let response = action.value();
let error = move || match response.get() {
Some(Err(e)) => Some(e.to_string()),
_ => None,
}; And then like a (When I try this I get a deserialization error because the form is expecting JSON, not a string with the error message, but that's a separate issue!) Some of these should probably spawn actual issues or feature requests; feel free to open issues if you run into problems like this. I'll do that now for the deserialization thing. |
Beta Was this translation helpful? Give feedback.
Yep so there are a handful of different things here:
error
signal into a<Form/>
but not an<ActionForm/>
, which will hold any errors that come up during the actual submission process... I should probably add that to<ActionForm/>
too..value()
of the action you're giving to the<ActionForm/>
..value()
returns…