skip to Main Content

I have this input box on my form:

<td contenteditable="true" class="date"></td>

and I’m trying to add a date dropdown to it so what I did was:

<td contenteditable="true" class="date"><input type="date"></td>

And now when I hit send it won’t save to the database. Are there any other ways to do this?

Here’s the whole code in case you need it:

<table class="table table-bordered" style="border-radius: 10px;" id="crud_table">
     <tr>
      <th width="30%">Requested By</th>
      <th width="10%">Start Date</th>
      <th width="10%">Employee Name</th>
      <th width="10%">Position</th>
      <th width="10%">Account</th>
      <th width="10%">Platform</th>
      <th width="45%">Processor</th>
      <th width="10%">RAM</th>
      <th width="10%">Monitor</th>
      <th width="10%">Phone</th>
      <th width="10%">Phone Type</th>
      <th width="10%">Headset</th>
     </tr>
     <tr>
      <td contenteditable="true" class="reqname" required></td>
      <td contenteditable="true" class="date"><input type="date"></td>
      <td contenteditable="true" class="empname"></td>
      <td contenteditable="true" class="position"></td>
      <td contenteditable="true" class="account"></td>
      <td contenteditable="true" class="platform"></td>
      <td contenteditable="true" class="processor"></td>
      <td contenteditable="true" class="ram"></td>
      <td contenteditable="true" class="monitor"></td>
      <td contenteditable="true" class="phone"></td>
      <td contenteditable="true" class="phonetype"></td>
      <td contenteditable="true" class="headset"></td>
     </tr>
    </table>

PS: I get All fields are required when I hit send so it mean I don’t get any values from the date dropdown.

2

Answers


  1. Add a name attribute to the <input type='date'>. In order for an element to be sent as a parameter when submitting a form (either POST or GET) it must have a valid name attribute.

    <input type="date" name="custom_date">
    
    Login or Signup to reply.
  2. input type “date” includes the year, month, and day, but not the time.

    <input type="date" name="custom_date" class="date">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search