gokul
gokul

Reputation: 1

ejs doesn't return the full string thats passed

<form class="item" action="/" method="post">

    <!-- listtitle = March 24, 2020' -->
    <input type="text" name="newItem" value="" placeholder="New item" autocomplete="off">
    <button type="submit" name="list" value= <%= listTitle %> >+</button>
</form>

When I perform the post request in the javascript file it works fine locally but when I connect to mongodb online database it doesn't return the full string instead it returns

let itemName = req.body.newItem;
let listPathName = req.body.list;
console.log("name of list " + listPathName); // displays March 24,

I need to display the full string.

Upvotes: 0

Views: 134

Answers (1)

akuoko_konadu
akuoko_konadu

Reputation: 36

Put the ejs tags into a quote, that way you would get the full string

Rather than value= <%= listTitle %> use value='<%= listTitle %>'

Upvotes: 1

Related Questions