Categories
Mastering Development

How can send readonly value from a form?

<form action="/upload" method="POST" enctype="multipart/form-data">
    <fieldset>
        <span>Event name</span>
        <input name = "name" type="text" class="form-control" value="<%= `${event.name}` %>" readonly>
    </fieldset>
    <fieldset>
        <button type="submit" id="form-submit" class="btn">Add Event</button>
    </fieldset>
</form>

and then i’m doing req.body.name and getting undefined… How do i resolve it?

app.post("/upload", (req, res) => {
    console.log(req.body.name);
});

Leave a Reply

Your email address will not be published. Required fields are marked *