???
import { useState } from 'react'
import {database} from './appwrite_test'
export const StoreValues = () => {
const [color, setColor] = useState('red')
const handleSubmit = (e) => {
e.preventDefault()
database.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {color}).then(success => {
//
}).catch((welp) => {
//
})
}
return <form onSubmit={handleSubmit}>
<input type="radio" value="red" id="colorRed" onChange={(e) => {
setColor(e.target.value)
}}/>
<label htmlFor="colorRed" >Red</label>
<input type="radio" value="blue" id="colorBlue" onChange={(e) => {
setColor(e.target.value)
}}/>
<label htmlFor="colorBlue">Blue</label>
<button type='submit'>Submit</button>
</form>
}
something like this? @bharath
i have created document in another file
its much better if you have a github repo and share it with us - since issues related to this are frequent so it will be helpful ❤️
ok i will
here it is
i want to store user input from 1.signup(username,email) 2.uploadcomp(filename) 3.select(color,side-radiobuttons) 4.showprice(table-values) under one documentid
thank you for sharing, i will take a look and let you know
Ok
Did you got it
hmm i found this...https://github.com/Bharathgit5/printfc.in/blob/3ce9700da228c4a1b51620eb485c5129fa4cf99d/src/Select.js#L22
This isn't how react works. I highly recommend taking a step back to get more practice with react: https://react.dev/learn
What's wrong with it
@Steven I want to complete this project asap
Please help me with it
I'm sorry, you really need to take the time to learn the basics
Please let me know where the mistake is..
You are not using state setters properly props.setState isn't a method + you are not using functions correctly. You should spend a week or so going through the basics again including some JS as well, then you should be at a better place to work on this project 🙂
On which topics should I go through
Basically iam new to coding its a continuous learning process
Basics of JS and DOM
then react
In react upto which topic https://react.dev/learn
all the topics in their learn page
And maybe some tutorials on forms in react. Like https://react.dev/learn/reacting-to-input-with-state
Recommended threads
- AppwriteException: Invalid query: Query ...
```js console.log(typeof interaction.user.id) console.log(interaction.user.id) const user_check = await TablesDB.listRows({ databaseId: "db", ...
- general_unauthorized_scope
localhost oauth not working. general_unauthorized_scope error showing. { "message": "User (role: guests) missing scopes ([\"account\"])", "code": 401, ...
- I recently switched to TablesDb. When li...
olddb.list_documents( queries =[ Query.order_desc("timestamp"), Query.equal("isPosted",[False]) ] ) Above works fine and reruns documents But below don't return...