Back

AppwriteException: The document payload is missing.

  • 1
  • Databases
  • Web
bharath
6 Apr, 2023, 14:06

???

TL;DR
User is facing an AppwriteException: The document payload is missing issue and also looking for React tutorials. Other users suggest going back to the basics and learning JavaScript and React properly. One user shares a code snippet to store user input in a document using Appwrite.
Arth
6 Apr, 2023, 14:15
TypeScript
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

bharath
6 Apr, 2023, 14:17

i have created document in another file

joeyouss
6 Apr, 2023, 14:21

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 ❤️

bharath
6 Apr, 2023, 14:22

ok i will

bharath
6 Apr, 2023, 14:27
bharath
6 Apr, 2023, 14:28

here it is

bharath
6 Apr, 2023, 14:32

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

joeyouss
6 Apr, 2023, 15:49

thank you for sharing, i will take a look and let you know

bharath
7 Apr, 2023, 02:21

Ok

bharath
7 Apr, 2023, 13:47

Did you got it

Drake
7 Apr, 2023, 21:16

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

bharath
8 Apr, 2023, 02:24

What's wrong with it

bharath
8 Apr, 2023, 02:26

@Steven I want to complete this project asap

bharath
8 Apr, 2023, 02:26

Please help me with it

Drake
8 Apr, 2023, 02:27

I'm sorry, you really need to take the time to learn the basics

bharath
8 Apr, 2023, 02:31

Please let me know where the mistake is..

Arth
8 Apr, 2023, 05:48

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 🙂

bharath
8 Apr, 2023, 05:49

On which topics should I go through

bharath
8 Apr, 2023, 05:50

Basically iam new to coding its a continuous learning process

Arth
8 Apr, 2023, 05:59

Basics of JS and DOM

Arth
8 Apr, 2023, 05:59

then react

bharath
8 Apr, 2023, 06:00

In react upto which topic https://react.dev/learn

Arth
8 Apr, 2023, 06:02

all the topics in their learn page

Drake
8 Apr, 2023, 15:59

And maybe some tutorials on forms in react. Like https://react.dev/learn/reacting-to-input-with-state

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more