Autocomplete text box

I have a mySQL table that houses an address book. (fields : firstname, lastname, address, phone, etc)

I have a PHP script that contains an HTML form.
On the form is a lastname field. As I start typing into the lastname form field, I would like it to autocomplete my entry with the contents of the lastname field from the table.

Is this only possible with client-side coding, such as javascript?

I am relatively new to PHP, but not clueless. Please give me some direction.

Comments

  • : I have a mySQL table that houses an address book. (fields : firstname, lastname, address, phone, etc)
    :
    : I have a PHP script that contains an HTML form.
    : On the form is a lastname field. As I start typing into the lastname form field, I would like it to autocomplete my entry with the contents of the lastname field from the table.
    :
    : Is this only possible with client-side coding, such as javascript?
    :
    : I am relatively new to PHP, but not clueless. Please give me some direction.
    :


    It is completely impossible.. even with javascript (i think)

    I don't believe there is a function that checks wiether a user has clicked on a key.. like onKeyPress.. in javascript, but there might be.

    The only way to do it is with, yes, a client-side program written in a real programming language like c or vb that works as an addon for a browser..

    I could be wrong but i am SURE that php cannot do it
    [b][blue]Snoochie Boochies[/blue][/b]

  • : : I have a mySQL table that houses an address book. (fields : firstname, lastname, address, phone, etc)
    : :
    : : I have a PHP script that contains an HTML form.
    : : On the form is a lastname field. As I start typing into the lastname form field, I would like it to autocomplete my entry with the contents of the lastname field from the table.
    : :
    : : Is this only possible with client-side coding, such as javascript?
    : :
    : : I am relatively new to PHP, but not clueless. Please give me some direction.
    : :
    :
    :
    : It is completely impossible.. even with javascript (i think)
    :
    : I don't believe there is a function that checks wiether a user has clicked on a key.. like onKeyPress.. in javascript, but there might be.
    :
    : The only way to do it is with, yes, a client-side program written in a real programming language like c or vb that works as an addon for a browser..
    :
    : I could be wrong but i am SURE that php cannot do it
    : [b][blue]Snoochie Boochies[/blue][/b]
    :
    :


    maybe it can be done with a java applet, but i think its a big chalenge...

  • : : : I have a mySQL table that houses an address book. (fields : firstname, lastname, address, phone, etc)
    : : :
    : : : I have a PHP script that contains an HTML form.
    : : : On the form is a lastname field. As I start typing into the lastname form field, I would like it to autocomplete my entry with the contents of the lastname field from the table.
    : : :
    : : : Is this only possible with client-side coding, such as javascript?
    : : :
    : : : I am relatively new to PHP, but not clueless. Please give me some direction.
    : : :
    : :
    : :
    : : It is completely impossible.. even with javascript (i think)
    : :
    : : I don't believe there is a function that checks wiether a user has clicked on a key.. like onKeyPress.. in javascript, but there might be.
    : :
    : : The only way to do it is with, yes, a client-side program written in a real programming language like c or vb that works as an addon for a browser..
    : :
    : : I could be wrong but i am SURE that php cannot do it
    : : [b][blue]Snoochie Boochies[/blue][/b]
    : :
    : :
    :
    :
    : maybe it can be done with a java applet, but i think its a big chalenge...
    :
    :

    if u wish to learn some vb script, and i think it will help.
  • [red]
    nah, there is a onchange parameter for that can be used to trigger a JS function.

    this function then must do the auto-completing. but, all needed for auto-completion must be stored (duh) in JS array's. if these array's ought to be dynamic, they should be echo'd from php.

    really, it's not impossible ;-)
    [/red]
    :
    :
    : It is completely impossible.. even with javascript (i think)
    :
    : I don't believe there is a function that checks wiether a user has clicked on a key.. like onKeyPress.. in javascript, but there might be.
    :
    : The only way to do it is with, yes, a client-side program written in a real programming language like c or vb that works as an addon for a browser..
    :
    : I could be wrong but i am SURE that php cannot do it
    : [b][blue]Snoochie Boochies[/blue][/b]
    :
    :

    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    http://mark.space.servehttp.com

  • : I have a mySQL table that houses an address book. (fields : firstname, lastname, address, phone, etc)
    :
    : I have a PHP script that contains an HTML form.
    : On the form is a lastname field. As I start typing into the lastname form field, I would like it to autocomplete my entry with the contents of the lastname field from the table.
    :
    : Is this only possible with client-side coding, such as javascript?
    :
    : I am relatively new to PHP, but not clueless. Please give me some direction.
    :


    Well i think onChange only works after you release focus from an element. He wants to do it while the person is typeing..


    Now if you wanted to use Java you could easily do it.
    They have much more options for such things, although not everyone has the java console and would require to download it to work.




    Now that i think about it. You could always use a onTimeout event that checks the textfields after a set number of miliseconds. It would work but would be extremely messy.

    Why don't you (if the lists aren't that long) make a select box with all the possible options instead?
    [b][blue]Snoochie Boochies[/blue][/b]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories