-
Bug ReportVersionaxum-form-mre v0.1.0 PlatformDarwin DescriptionHey everyone, I'm kinda new to Axum and running into a issue trying to get nested form data working with the standard Basically, I have a form where I want to submit a list of items <form action="/" method="post">
<div>
<label>Name 1: <input type="text" name="name" value="Alice"></label>
</div>
<div>
<label>Name 2: <input type="text" name="name" value="Bob"></label>
</div>
<div>
<label>Name 3: <input type="text" name="name" value="Charlie"></label>
</div>
<hr>
<div>
<label>Email 1: <input type="email" name="email" value="alice@example.com"></label>
</div>
<div>
<label>Email 2: <input type="email" name="email" value="bob@example.com"></label>
</div>
<input type="submit" value="Submit">
</form> On rust side I am using following code #[derive(Deserialize, Debug)]
struct FormData {
name: Vec<String>,
email: Vec<String>,
}
async fn accept_form(form: Form<FormData>) -> Html<String> {
println!("Successfully deserialized: {:#?}", form);
Html("42".to_string())
} When I submit the form I get following error
Is this expected behavior? Or am I missing something obvious? I saw some mentions of using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Take a look at |
Beta Was this translation helpful? Give feedback.
Take a look at
axum_extra::extract::Form
.