Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<form action="/attendence" method="post">
        <ul>
          <% for (let user of usersdata) { %>
          <li class="listItems">
            <a class="names" href="/users/<%=user.id%>"> <%=user.username%> </a>
            <input type="checkbox" class="checkbox" />
         
          </li>
          <% } %>
        </ul>
      </form>


What I have tried:

I want that only those names to be passed to '/attendence' api's request body that have checkboxes checked. I am working with nodejs and ejs templating engine. Please help, Thanks in advanced.
Posted
Updated 24-Nov-22 2:20am

1 solution

You haven't explained what data your back-end needs to receive. Assuming you just want to send a list of the username for each checked user, you just need to add a name and value to your checkboxes:
HTML
<input type="checkbox" class="checkbox" name="username" value="<%=user.username%>" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900