This code snippet will allow you to create a HTML form date element that will automatically submit when selecting the date. This will bypass the need to choose a date, then click submit. This will also hide the submit button since it won't be used.

<form id="chooseDate" action="webpage.php" method="post">
    <input type="date" name="selectedDate" value="<?= date('Y-m-d'); ?>" oninput='chooseDate.submit()'>
    <noscript>
        <input type="submit" value="Submit">
    </noscript>
</form>

This code snippet was published on It was last edited on

2

0 Comments

  • Votes
  • Oldest
  • Latest