mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
prepared autocomplete
This commit is contained in:
parent
1c18fe20a0
commit
7b700cb820
5 changed files with 14 additions and 13 deletions
1
bin/bootstrap.autocomplete.js
vendored
Normal file
1
bin/bootstrap.autocomplete.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -4,15 +4,14 @@ $(document).ready(function () {
|
|||
$("input[type=number]").on("focus", function () { $(this).select(); });
|
||||
$("input[type=text]").on("focus", function () { $(this).select(); });
|
||||
|
||||
// $(".ingredientName").on("focus", function () {
|
||||
// autocomplete(this, values);
|
||||
// });
|
||||
// $(".ingredientName").keydown(function (x) {
|
||||
// if ((x.keyCode == 9) && ($(this).parent().parent().next().prop("class") != $(this).parent().parent().prop("class"))) {
|
||||
// $(this).parent().parent().find(".addIngredient").click();
|
||||
// }
|
||||
// });
|
||||
// $(".ingredientAmount").on("focus", function () { $(this).select(); });
|
||||
// implement autocomplete with https://bootstrap-autocomplete.readthedocs.io/en/latest/#
|
||||
$(".autocomplete-ingredient").autoComplete(
|
||||
{
|
||||
resolverSettings: {
|
||||
url: '/api/recipes/auto'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
$additionalInput = "";
|
||||
}
|
||||
?>
|
||||
<!-- <script src="/bin/autocomplete.js" charset="utf-8"></script> -->
|
||||
<script src="/bin/bootstrap.autocomplete.js" charset="utf-8"></script>
|
||||
<script src="/bin/manageRecipe.js" charset="utf-8"></script>
|
||||
<?php echo $script; ?>
|
||||
<div class="container mt-5">
|
||||
|
@ -55,7 +55,7 @@
|
|||
?>
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="ingredient[1][Name]" placeholder="Zutat" required>
|
||||
<input type="text" class="autocomplete-ingredient form-control" name="ingredient[1][Name]" placeholder="Zutat" autocomplete="off" required>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text p-0"><button onclick="removeItem(this);" class="removeItem fas fa-trash-alt bg-transparent rounded-right border-0 p-2 pl-3 pr-3 text-danger"></button></span>
|
||||
</div>
|
||||
|
|
|
@ -180,8 +180,9 @@
|
|||
$values = array();
|
||||
$result = $mysqli->query("SELECT Name FROM Zutat ORDER BY Name ASC");
|
||||
while($item = $result->fetch_assoc()){
|
||||
echo $item["Name"]."||";
|
||||
array_push($values, $item["Name"]);
|
||||
}
|
||||
print_r(json_encode($values));
|
||||
$mysqli->close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue