#EJS Problems
1 messages · Page 1 of 1 (latest)
Console log req.body. I believe that’s what you are supposed to use to get a forms values upon a POST request.
Hmmm,
remove your onclick thing and the javascript function
you don't need any of that
and get rid of that
Real. Just have a form action of /submit-form
Yuh. That should in theory work
when i submit this happens
Wrong action
<form action="/submit-form" id="embedinputs">
Oh
<form action="/sendembed" id="embedinputs" method="POST" >
how do i access it in te server js?
req.body
As long as all your inputs have a name attribute attached then you can access it in the req.body object
Eg: <input type="text" class="input input-bordered" name="name" placeholder="Type here..."required/>
Just do body not channel id
I didn’t even read the txt file 💀 lol

Also undefined
are you using bodyParser, multer, and express.json??
const express = require("express");
const multer = require('multer');
const bodyParser = require('body-parser');
var multerStorage = multer.memoryStorage()
app.use(multer({ storage: multerStorage }).any());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.json());
you dont need multer unless you are using multipart/form-data in the form tag which is commonly used to upload files to the server
also on your form tag be sure that you have the method equal to post
not sure if you're trying to educate me on something I already know or not lol. More often then not people will want to upload files or pictures in their post requests, assuming that's something he'd like to do for his bot panel I just assume it's better to give the full answer to solve the entire problem instead of half the answer for him to come back and ask again later

Not trying to educate you, just stating the facts. He asked about using a form and req.body never once did he mention uploading files. Just telling someone to use something in this case multer when they might not need it at all is not good in anyway. For someone who seems to be learning it is also better to run into problems and ask for help rather than something working and you have no idea why.
from my experience I'd prefer to be educated and given a full answer rather than sit on stack overflow searching to find why req.files[0] is still undefined when I'm sending a file request. If I'm given a full and complete answer to cover ALL aspects, then I'd be much happier.

I could have told you to google the difference between for(let item of row) and for(let item in row) but instead I just gave you a full and complete answer. Spoonfeeding is only bad if you do it for a long period of time. Asking simple questions and giving detailed answers can be far better in many situations rather than having them come across an issue and risk giving up thinking it's impossible
Me personally I like the feeling of trying to figure out problems and being close to giving up. I feel that makes people stronger, better and more independent developers
Thas jus me tho
You are missing the point just saying oh put this there is not teaching anything. A better way to go about thing would have been explaining why you put what you put. From what you said to him I would have assumed that multer is necessary to submit form data no matter what
LMAO
Luis i love you
luh you too
Fixxed it
I Just used body['inputname']
Not body.inputname
Together with bodyparser
you have it set as a post request when the default for most browsers is to preform a git request, make sure the method is set correctly in the form!
bruh
no
you are so wrong it's not even funny
POST requests are used to send data from form elements
GET requests are primarily used strictly for front-end viewing or requests that do not require you to send a body of data
A browser is not what is making HTTP requests, it's the client. I tell my browser what to do. It doesn't do it on it's own
@smoky isle Don't bother pinging me when you come in to provide the google definition for every term I've used. 💀
Does the client have access to the home Wi-Fi network?



