Jump to content

autocomplete textfield with AJAX and php?


arianhojat

Recommended Posts

Hello all,

 

I saw a neat demo example of this using script.aculo.us and ruby on rails framework to do autocomplete textfield.

http://demo.script.aculo.us

 

but was wondering if there is anything to run similar on php platform (with AJAX/scriptalicious also doing same effects)?

 

My current regular old html dropdown list has thousands of clients currently and it is taking >10 seconds filling the <option> list, hence why i am looking to use a short autocomplete list to let user fill in clientname.

Since this page can be edited, i hope there is a framework that knows that fills the text in the textfield appropriately like all the demos i see online,

but it should also set a hidden form field with the ID of the client chosen. so if they click Update, then i can use that clientID value to update the database. Also if the user erases the text (or maybe fills in half of the text but doesnt choose a client from drop down), the hidden form field clientID should be removed so i know the user is unsetting the optional field/ or hasnt chosen a client.... and i can accordingly update the clientID field to NULL in database.

 

Thanks in advance for any input!

Link to comment
https://forums.phpfreaks.com/topic/48312-autocomplete-textfield-with-ajax-and-php/
Share on other sites

i have a question why script.aculo.us autocomplete demo code

doesnt work if you change the filename from test.html to test.php pretend (also i running this on IIS if that makes a difference)... like so:

 

Anyone have same issue?

 

PS i attached the script.aculo.us code but if u dont trust running/testing it, just goto the download script.aculo.us and goto the scriptaculous\test\functional folder and change the filename of ajax_autocompleter2_test.html to .php and try that in your browser.

doesnt work for me. get a IIS http 405 error.

 

[attachment deleted by admin]

i think i got it.

IIS might be blocking POSTs? because of security restrictions.

so use in the options  method:'get'... like so...

  new Ajax.Autocompleter('ac2','ac2update','getClientList.php', { method:'get', fullSearch: true, partialSearch: true } );

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.