Comments (8)
@thejackshelton I am done, do I PR in the reproduction repo or where exactly do I submit the PR?
from qwik.
@rendaoer hi, I would be willing to work on it. Can you assign me as an assignee?
from qwik.
@yousefmarey12 here ya go 😄
from qwik.
@thejackshelton I am done, do I PR in the reproduction repo or where exactly do I submit the PR?
https://github.com/QwikDev/qwik/blob/main/CONTRIBUTING.md
The contributing file here goes in-depth on how to make a PR to the Qwik repo.
Did you find the solution in the application? Or did you need to change something in the Qwik repo?
from qwik.
thank you all
from qwik.
@thejackshelton I found the solution in the application.
from qwik.
The Complex Forms Docs says that you get an object and not an array as a result of the form submission.
In your case, having a form name of just "worlds" would just return an object that has "worlds" as a property and ONE value since it's a key-value pair. The solution is to make the form like this
<label for="w1">A</label>
<input id="w1" name="worlds.A" type="checkbox" value="A" />
<label for="w2">B</label>
<input id="w2" name="worlds.B" type="checkbox" value="B" />
<label for="w3">C</label>
<input id="w3" name="worlds.C" type="checkbox" value="C" />
<button type="submit">Submit</button>
This will submit only a worlds object but its value will be the ones that you checked. The ones that you checked will of course, contain the actual value.
Now if you really want an array then you can do
export const useSubmitForm = routeAction$((data) => {
console.log(inspect(Object.values(data.worlds), { depth: null })); // consoles the array
zod$({ worlds: z.array(z.string()) });
});
This makes an array of the values of data.worlds and that's the array of all checked boxes for you.
Did I solve your problem?
p.s inspect is just a built-in function in node just to help me read the values.
from qwik.
@yousefmarey12
However, back-end frameworks usually provide data list acquisition or automatic type conversion. Normal form submission also has multiple checkbox data, so I think it is not intuitive.
from qwik.
Related Issues (20)
- [🐞] Version 1.5.3 build is broken: Cannot load native addon because loading addons is disabled HOT 4
- [🐞] Duplicate export on "npm run build.client"
- [📖] prevent scrollbar reset for sidebar
- [📖] replace p element in starters HOT 2
- [✅] fixes for all "Error: Missing Qwik City Env Data" HOT 2
- [🐞] Non-deterministic builds
- [📖] onLoad$ img cookbook
- [🐞] SSG ignoring the index page when trailingSlash is false HOT 3
- [🐞] Disable Link prefetch true by default HOT 2
- [📖] Sidebar Issue HOT 2
- [✨] How to distinguish between link preload and page visit HOT 1
- [🐞] Qwik dev server fails when using mkcert/https because of http2 headers HOT 1
- [📖] Copy the current Qwik docs homepage
- [✨] Throw server$ errors with a specific status code HOT 4
- [🐞] Attribute re-render on spread in polymorphism does not work correctly HOT 1
- [🐞] Route is broken with deep nesting HOT 4
- [✨] Automatic simple 404 responses for file requests HOT 9
- [✨] Create a unique file name for each version of service-worker.js HOT 16
- [🐞] Error Boundary Issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qwik.