Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Auto completing a form from and to a mysql database

by Fletch (Bishop)
on Oct 15, 2020 at 14:03 UTC ( [id://11122860]=note: print w/replies, xml ) Need Help??


in reply to Auto completing a form from and to a mysql database

This is 95% a client side problem. You'd need to use something like jQuery and javascript on the client to populate things that you get back from the server (e.g. when they've typed your three letters in the Artist field it'd fire off an AJAX request to /api/complete?field=Artist&entry=van which would return a JSON list of everything matching "van" in your DB).

Here's a sample mojo implementation that a quick search turned up on SO.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Auto completing a form from and to a mysql database
by marto (Cardinal) on Oct 15, 2020 at 16:28 UTC

    "You'd need to use something like jQuery and javascript"

    Probably not. For personal projects I ditched it's while back

      Searching for "autocomplete" on that page returns no results though.

      You certainly could roll your own autocomplete without it, and there are other (JS) frameworks which probably provide a similar widget but . . . bleh.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

        That's quite the turn around from saying jQuery was "needed" :P That page is about getting rid of jQuery as a dependency, not replacing every plugin upon which jQuery is required. While there are various options for drop in jQueryless autocomplete/typeahead HTML5 has datalist which negates a lot of the use cases anyway.

Re^2: Auto completing a form from and to a mysql database
by Dazz45X (Novice) on Oct 15, 2020 at 15:25 UTC

    Thanks for your helpFletch

    That link looks useful I've got something that looks similar but with different libraries I'll give it a go a bit later. Guess I need to have a look at AJAX whilst I'm at it as well

    Thank you

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122860]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-26 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found