solid-start
solid-start copied to clipboard
[bug] FORM component not responding
<FORM>
component stop working as intented when you use <br/>
tags in it
Working example:
<Form>
<label for="username">Username:</label>
<br/>
<input type="text" name="username" />
<input type="submit" value="submit" />
</Form>
This report isn't helpful, it's incredibly unclear what the issue actually is, and looks like it was written in a rush
Please send a reproduction using codesandbox
My original message got cut, sorry for the inconvenience. clipboard command failed.
It's still unclear what the actual issue is. An error and (ideally)/or a reproduction will be helpful
export function MyComponent() {
const [_, { Form }] = createRouteAction(async (formData: FormData) => {
await new Promise((resolve, reject) => setTimeout(resolve, 1000));
const username = formData.get("username");
if (username === "admin") {
return redirect("/admin");
} else {
throw new Error("Invalid username");
}
return redirect("/home");
});
return (
<Form>
<label for="username">Username:</label>
<input type="text" name="username" />
<input type="submit" value="submit" />
</Form>
);
}
👆that is a normal form with normal form behavior
export function MyComponent() {
const [_, { Form }] = createRouteAction(async (formData: FormData) => {
await new Promise((resolve, reject) => setTimeout(resolve, 1000));
const username = formData.get("username");
if (username === "admin") {
return redirect("/admin");
} else {
throw new Error("Invalid username");
}
return redirect("/home");
});
return (
<Form>
<label for="username">Username:</label>
<br/>
<input type="text" name="username" />
<input type="submit" value="submit" />
</Form>
);
}
👆That form is broken, formData.get return an empty object
Hmm.. that's unusual. I feel I'm missing something.. I put a bunch of br's in the TodoMVC example that is all forms and they all still worked. Help a ton to have a reproduction.
Stale/no reproduction closing.