summaryrefslogtreecommitdiff
path: root/includes/sys_form.php
diff options
context:
space:
mode:
authorMichiK <6341204+der-michik@users.noreply.github.com>2018-12-03 11:39:16 +0100
committermsquare <msquare@notrademark.de>2018-12-03 19:21:45 +0100
commit36b7f8d2a2c732725c8993e1df16d454c0e9d47c (patch)
tree40a27b6b7036b12fd9a2729e91145894a2b82715 /includes/sys_form.php
parent5696dbffc292375f5b5937a0c3b9573bedc823f6 (diff)
Fix datepicker
`<input type="date">` and JS datepicker combined cause trouble in some browsers, so this changes all the date input fields' type to `text` via JS so that the browser's datepicker is only used when a user has disabled JavaScript. In addition, it adds a placeholder so the user knows which date format to use when entering the date manually. This closes #507.
Diffstat (limited to 'includes/sys_form.php')
-rw-r--r--includes/sys_form.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/includes/sys_form.php b/includes/sys_form.php
index f9779ec7..b5a957c0 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -73,11 +73,12 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
return form_element($label, '
<div class="input-group date" id="' . $dom_id . '">
- <input type="date" name="' . $name . '" class="form-control" value="' . htmlspecialchars($value) . '">'
+ <input type="date" placeholder="YYYY-MM-DD" name="' . $name . '" class="form-control" value="' . htmlspecialchars($value) . '">'
. '<span class="input-group-addon">' . glyph('th') . '</span>
</div>
<script type="text/javascript">
$(function(){
+ $("#' . $dom_id . '").children("input").attr("type", "text");
$("#' . $dom_id . '").datepicker({
language: "' . $shortLocale . '",
todayBtn: "linked",