fix label to input link for `form_spinner`, `form_date` and `form_datetime`
This commit is contained in:
parent
9c3c2cc2ac
commit
6d5748f9f8
|
@ -47,7 +47,7 @@ function form_spinner($name, $label, $value)
|
||||||
spinner.val(parseInt(spinner.val()) + 1);
|
spinner.val(parseInt(spinner.val()) + 1);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
');
|
', 'spinner-' . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,11 +68,11 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
|
||||||
$start_date = is_numeric($start_date) ? date('Y-m-d', $start_date) : '';
|
$start_date = is_numeric($start_date) ? date('Y-m-d', $start_date) : '';
|
||||||
$end_date = is_numeric($end_date) ? date('Y-m-d', $end_date) : '';
|
$end_date = is_numeric($end_date) ? date('Y-m-d', $end_date) : '';
|
||||||
|
|
||||||
return form_element($label, '
|
return form_element(
|
||||||
<div class="input-group date" id="' . $dom_id . '">
|
$label,
|
||||||
<input type="date" placeholder="YYYY-MM-DD" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" min="' . $start_date . '" max="' . $end_date . '" name="' . $name . '" class="form-control" value="' . htmlspecialchars((string)$value) . '" autocomplete="off">
|
'<input class="form-control" id="' . $dom_id . '" type="date" placeholder="YYYY-MM-DD" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" min="' . $start_date . '" max="' . $end_date . '" name="' . $name . '" value="' . htmlspecialchars((string)$value) . '" autocomplete="off">',
|
||||||
</div>
|
$dom_id
|
||||||
', $dom_id);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,12 +92,9 @@ function form_datetime(string $name, string $label, $value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return form_element($label, sprintf('
|
return form_element($label, sprintf('
|
||||||
<div class="input-group datetime" id="%s">
|
<input class="form-control" id="%s" type="datetime-local"
|
||||||
<input type="datetime-local"
|
|
||||||
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" placeholder="YYYY-MM-DD HH:MM"
|
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" placeholder="YYYY-MM-DD HH:MM"
|
||||||
name="%s"
|
name="%s" value="%s" autocomplete="off">
|
||||||
class="form-control" value="%s" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id);
|
', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,15 +272,11 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 col-lg-2">
|
<div class="col-md-3 col-lg-2">
|
||||||
<label class="form-label" for="input_date">Date</label>
|
<label class="form-label" for="input_date">Date</label>
|
||||||
<div class="input-group date">
|
<input id="input_date" type="date" placeholder="YYYY-MM-DD" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="design-date" class="form-control" value="2021-09-15">
|
||||||
<input id="input_date" type="date" placeholder="YYYY-MM-DD" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" name="design-date" class="form-control" value="2021-09-15">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-lg-2">
|
<div class="col-md-3 col-lg-2">
|
||||||
<label class="form-label" for="input_datetime_local">Datetime</label>
|
<label class="form-label" for="input_datetime_local">Datetime</label>
|
||||||
<div class="input-group datetime">
|
<input id="input_datetime_local" type="datetime-local" placeholder="YYYY-MM-DD HH:MM" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" name="design-datetime" class="form-control" value="2021-09-15T13:37">
|
||||||
<input id="input_datetime_local" type="datetime-local" placeholder="YYYY-MM-DD HH:MM" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" name="design-datetime" class="form-control" value="2021-09-15T13:37">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue