How to receive backend responses and render accordingly on the frontend based on different responses? #4213
Answered
by
callmeitachi
callmeitachi
asked this question in
Q&A
-
When developing with Cargo Leptos, taking a login page as an example, if I use and perform a series of backend validations, multiple responses might be returned. If the response status is not 200, how can I implement displaying error messages using the alert method on the frontend? |
Beta Was this translation helpful? Give feedback.
Answered by
callmeitachi
Aug 14, 2025
Replies: 1 comment 4 replies
-
There are many ways to do what you're describing. Please provide some example code that shows what you've tried so far and what isn't working. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On the login page, I want to first verify on the client side whether the two password inputs match. If the passwords don't match when clicking login, I want to use the alert function to notify the user. However, when I click the submit button, the ActionForm also executes server-side functions, which I don't want.
Additionally, when the passwords do match, I want to receive the backend response to inform the user whether login was successful. If verification fails, I want to use alert to notify the user of incorrect password.Here is my code: