???
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
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...
- Custom emails
What happen if I use a third party email provider to customize my emails and my plan run out of emails/month? Appwrite emails are used as fallback sending emai...