Brennan  Veum

Brennan Veum

1618138800

Vuetify — Autocomplete and Combobox

Vuetify is a popular UI framework for Vue apps.

In this article, we’ll look at how to work with the Vuetify framework.

Async Autocomplete

The v-autocomplete components work with async data sources.

For example, we can write:

#javascript

What is GEEK

Buddha Community

Vuetify — Autocomplete and Combobox
Ethan Hughes

Ethan Hughes

1578335505

Collection of Good Vue Autocomplete Components for Your Vue.js App

The Vue AutoComplete component helps users by providing a list of suggestions to select from as they type. It supports data binding, filtering, and more.

1. vue-suggestion

Suggestion list input for Vue.js, inspired by v-autocomplete.
Your search engine, your CSS, your everything…

vue-suggestion

Demo

Download


2. Accessible Autocomplete

Accessible autocomplete component for vanilla JavaScript and Vue.

Features

  • Accessible, with full support for ARIA attributes and keyboard interactions. Based on the WAI-ARIA Authoring Practices.
  • Available as a JavaScript or Vue component, with React coming soon.
  • Core package available if you want to bring your own rendering layer.
  • Customizable. Easily bring your own CSS, or take full control of the component rendering.
  • Support for asynchronous data fetching.

Autocomplete

Demo

Download


3. Select Auto-Complete

Provides a capability of auto-completed searching for results inside a select input field.

Select Auto-Complete

Download


4. vue-cool-select

Select with autocomplete, slots, bootstrap and material design themes.

Features

  • no dependencies
  • props (30) allow you to customize a component in a various ways
  • slots (13) allow content to be changed anywhere
  • events (8) will let you know about everything
  • autocomplete (you can use custom search, you can also disable the search input)
  • keyboard controls (not only through the arrows)
  • support on mobile devices
  • validation, state of error and success
  • disabled and readonly
  • small and large sizes (as in bootstrap)
  • the ability to set your styles, you can write theme from scratch. 2 themes: Bootstrap 4 (equal styles), Material Design
  • TypeScript support
  • tab navigation
  • SSR (Server-Side Rendering)
  • auto determine the suitable position for the menu if it goes beyond the viewport

vue-cool-select

Demo

Download


5. Vue Form Autocomplete - Simple

Vue Form Autocomplete Custom Component.

Able to use single or multiple select. Use scope slot to change the template

Vue Form Autocomplete - Simple

Demo and Download


6. Vue Tags Input

A simple tags input with typeahead built with Vue.js 2.

Vue Tags Input

Demo

Download


7. At.js for Vue.

At.js is An autocompletion library to autocomplete mentions, smileys etc.

  • Filter/Scroll/Insert/Delete
  • Keyboard/Mouse events
  • Plain-text based, no jQuery, no extra nodes
  • ContentEditable
  • Avatars, custom templates
  • Vue2
  • Vue1

At.js for Vue

Demo

Download


Thank for read!

#vue-autocomplete #autocomplete-component #autocomplete #vue-js #autocomplete-vue

I am Developer

1614263355

Google Places Autocomplete In PHP with Example

PHP 8 google address autocompletes without showing the map. In this tutorial, i will show youhow to create a google autocomplete address web app using google address APIs in PHP.

Note that, Google autocomplete address API will return address and as well as latitude, longitude, place code, state, city, country, etc. Using latitude and longitude of address, you can show markers location in google map dynamically in php.

This tutorial guide to you step by step how to implement google places autocomplete address web application without showing google maps in PHP.

For implementing the autocomplete address in php, you will have to get the key from google console app. So, just go to the link https://cloud.google.com and get the google API key.

https://www.tutsmake.com/php-google-places-autocomplete-example/

#autocomplete address google api php #google places autocomplete example in php #google places autocomplete example without map in php #php google places autocomplete jquery #php google places autocomplete jquery example

I am Developer

1611112146

Codeigniter 4 Autocomplete Textbox From Database using Typeahead JS - Tuts Make

Autocomplete textbox search from database in codeigniter 4 using jQuery Typeahead js. In this tutorial, you will learn how to implement an autocomplete search or textbox search with database using jquery typehead js example.

This tutorial will show you step by step how to implement autocomplete search from database in codeigniter 4 app using typeahead js.

Autocomplete Textbox Search using jQuery typeahead Js From Database in Codeigniter

  • Download Codeigniter Latest
  • Basic Configurations
  • Create Table in Database
  • Setup Database Credentials
  • Create Controller
  • Create View
  • Create Route
  • Start Development Server

https://www.tutsmake.com/codeigniter-4-autocomplete-textbox-from-database-using-typeahead-js/

#codeigniter 4 ajax autocomplete search #codeigniter 4 ajax autocomplete search from database #autocomplete textbox in jquery example using database in codeigniter #search data from database in codeigniter 4 using ajax #how to search and display data from database in codeigniter 4 using ajax #autocomplete in codeigniter 4 using typeahead js

Gordon  Matlala

Gordon Matlala

1670597340

How to Create jQuery UI autocomplete with PostgreSQL PHP & AJAX

jQuery UI autocomplete allows the user to select an item from the suggestion list based on the typed value.

You can load the suggestion list with and without AJAX.

In this tutorial, I show how you can add jQuery UI autocomplete on your page and load PostgreSQL database data using AJAX and PHP.

Contents

  1. Table structure
  2. Configuration
  3. Download and Include
  4. HTML
  5. PHP
  6. jQuery
  7. Output
  8. Conclusion

1. Table structure

I am using users table in the example.

CREATE TABLE users (
     id serial PRIMARY KEY,
     username varchar(80) NOT NULL,
     fullname varchar(80) NOT NULL,
     email varchar(80) NOT NULL
)

2. Configuration

Create a new config.php file.

Completed Code

<?php

$host = "localhost";
$user = "postgres";
$password = "root";
$dbname = "tutorial";
$con = pg_connect("host=$host dbname=$dbname user=$user password=$password");

if (!$con) {
   die('Connection failed.');
}

3. Download and Include

  • Download jQuery and jQuery UI libraries.
  • Include jQuery and jQuery UI library script –
 <!-- CSS -->
 <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">

 <!-- Script -->
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

4. HTML

Create 2 text elements –

  • 1st is used to initialize jQuery UI autocomplete.
  • 2nd is used to display the selected item value from the suggestion list.

Completed Code

<!-- For defining autocomplete -->
Search User : <input type="text" id='autocomplete'> <br><br>

<!-- For displaying selected option value from autocomplete suggestion -->
Selected UserID : <input type="text" id='selectuser_id' readonly>

5. PHP

Create ajaxfile.php file to handle jQuery UI AJAX requests.

Check if search is POST or not.

If not POST then fetch all records from users table and assign to $result otherwise, search on fullname field and assign fetched records to $result.

Loop on $result and initialize $data Array with value and label keys.

Store $id in value and $fullname in label.

Return $data in JSON format.

Completed Code

<?php
include 'config.php';

$result = array();
if(!isset($_POST['search'])){ 
      $sql = "select * from users order by fullname"; 
      $result = pg_query($con, $sql);
}else{ 
      $search = $_POST['search']; 

      $sql = "select * from users where fullname ilike $1";
      $result = pg_query_params($con, $sql, array('%'.$search.'%'));
}

$data = array();

while ($row = pg_fetch_assoc($result) ){

     $id = $row['id'];
     $fullname = $row['fullname'];

     $data[] = array(
         "value" => $id, 
         "label" => $fullname
     );

}

echo json_encode($data);
die;

6. jQuery

Initialize autocomplete on #autocomplete.

  • Use source option to load autocomplete data using jQuery AJAX.
  • Send AJAX POST request to ajaxfile.php, set dataType to json, and pass typed values as data.
  • On successful callback pass data to response().
  • Using select event to display selected option label in the #autocomplete and value in #selectuser_id input fields.

Completed Code

$(document).ready(function(){

   // Single Select
   $( "#autocomplete" ).autocomplete({
        source: function( request, response ) {

             // Fetch data
             $.ajax({
                  url: "ajaxfile.php",
                  type: 'post',
                  dataType: "json",
                  data: {
                       search: request.term
                  },
                  success: function( data ) {
                       response( data );
                  }
             });
        },
        select: function (event, ui) {
             // Set selection
             $('#autocomplete').val(ui.item.label); // display the selected text
             $('#selectuser_id').val(ui.item.value); // save selected id to input
             return false;
        }
    });

});

7. Output

View Output


8. Conclusion

If the suggestion list is not displaying then use the browser network tab to debug.

Make sure the return response is in valid format otherwise, the data does not load properly.

You can view the MySQL version of this tutorial here.

If you found this tutorial helpful then don't forget to share.

 

Original article source at: https://makitweb.com/

#postgresql #php #ajax 

Shayna  Lowe

Shayna Lowe

1658221560

Comment créer jQuery UI Autocomplete avec PostgreSQL PHP et AJAX

La saisie semi-automatique de l'interface utilisateur jQuery permet à l'utilisateur de sélectionner un élément dans la liste de suggestions en fonction de la valeur saisie.

Vous pouvez charger la liste de suggestions avec et sans AJAX.

Dans ce didacticiel, je montre comment vous pouvez ajouter la saisie semi-automatique jQuery UI sur votre page et charger les données de la base de données PostgreSQL à l'aide d'AJAX et de PHP.

1. Structure du tableau

J'utilise  userstable dans l'exemple.

CREATE TABLE users (
     id serial PRIMARY KEY,
     username varchar(80) NOT NULL,
     fullname varchar(80) NOT NULL,
     email varchar(80) NOT NULL
)

2. Configuration

Créez un nouveau config.phpfichier.

Code terminé

<?php

$host = "localhost";
$user = "postgres";
$password = "root";
$dbname = "tutorial";
$con = pg_connect("host=$host dbname=$dbname user=$user password=$password");

if (!$con) {
   die('Connection failed.');
}

3. Téléchargez et incluez

 <!-- CSS -->
 <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">

 <!-- Script -->
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

4.HTML

Créez 2 éléments de texte –

  • 1st est utilisé pour initialiser la saisie semi-automatique de l'interface utilisateur jQuery.
  • 2nd est utilisé pour afficher la valeur de l'élément sélectionné dans la liste de suggestions.

Code terminé

<!-- For defining autocomplete -->
Search User : <input type="text" id='autocomplete'> <br><br>

<!-- For displaying selected option value from autocomplete suggestion -->
Selected UserID : <input type="text" id='selectuser_id' readonly>

5.PHP

Créer ajaxfile.phpun fichier pour gérer les requêtes jQuery UI AJAX.

Vérifiez si searchest POST ou non.

Si ce n'est pas POST, récupérez tous les enregistrements de usersla table et attribuez-les à $resultsinon, recherchez sur le fullnamechamp et attribuez les enregistrements récupérés à $result.

Bouclez $resultet initialisez $dataArray avec les touches valueet .label

Stocker $iddans valueet $fullnamedans label.

Retour $dataau format JSON.

Code terminé

<?php
include 'config.php';

$result = array();
if(!isset($_POST['search'])){ 
      $sql = "select * from users order by fullname"; 
      $result = pg_query($con, $sql);
}else{ 
      $search = $_POST['search']; 

      $sql = "select * from users where fullname ilike $1";
      $result = pg_query_params($con, $sql, array('%'.$search.'%'));
}

$data = array();

while ($row = pg_fetch_assoc($result) ){

     $id = $row['id'];
     $fullname = $row['fullname'];

     $data[] = array(
         "value" => $id, 
         "label" => $fullname
     );

}

echo json_encode($data);
die;

6. jQuery

Initialiser la saisie semi-automatique sur #autocomplete.

  • Utilisez sourcel'option pour charger les données de saisie semi-automatique à l'aide de jQuery AJAX.
  • Envoyez la requête AJAX POST à ajaxfile.php​​, définissez - dataTypela sur jsonet transmettez les valeurs saisies en tant que data.
  • En cas de rappel réussi, transmettez les données à response().
  • Utilisation  selectde l'événement pour afficher l'option sélectionnée label dans les   champs  de  saisie #autocomplete et  .value#selectuser_id

Code terminé

$(document).ready(function(){

   // Single Select
   $( "#autocomplete" ).autocomplete({
        source: function( request, response ) {

             // Fetch data
             $.ajax({
                  url: "ajaxfile.php",
                  type: 'post',
                  dataType: "json",
                  data: {
                       search: request.term
                  },
                  success: function( data ) {
                       response( data );
                  }
             });
        },
        select: function (event, ui) {
             // Set selection
             $('#autocomplete').val(ui.item.label); // display the selected text
             $('#selectuser_id').val(ui.item.value); // save selected id to input
             return false;
        }
    });

});

7. Sortie

Afficher la sortie


8.Conclusion

Si la liste de suggestions ne s'affiche pas, utilisez l'onglet réseau du navigateur pour déboguer.

Assurez-vous que la réponse de retour est dans un format valide, sinon les données ne se chargent pas correctement.

Source :  https://makitweb.com

#php #jquery #ajax #postgresql