Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Dropdown menu events..

  • 18-06-2009 06:18PM
    #1
    Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭


    Hi,

    I'm lookin to have a dropdown menu that has a list of peoples names. When a name is selected.. ajax kicks in and queries a DB to get the details of the user. Those details are printed into another text box..

    Basically: How can I tell the browser to call a function when one of the items has been selected.. something like onClick for a button but that doesn't work?

    I'm rushing out now but if I haven't explained my problem very well i'll post examples later...

    Thanks..


Comments

  • Closed Accounts Posts: 7,144 ✭✭✭DonkeyStyle \o/


    Uh, onchange works for dropdowns AFAICR.
    But take your pick here -> http://www.w3schools.com/jsref/jsref_events.asp


  • Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭techguy


    Uh, onchange works for dropdowns AFAICR.
    But take your pick here -> http://www.w3schools.com/jsref/jsref_events.asp

    Perfect, thanks!!


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Forgive me if I'm a little confused by the fact that someone who doesn't know about onchange is considering using AJAX......


  • Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭techguy


    Liam Byrne wrote: »
    Forgive me if I'm a little confused by the fact that someone who doesn't know about onchange is considering using AJAX......

    Don't be confused! My knowledge on Javascript and DOM are really non existent. I literally grabbed a tutorial online that pulled some info from one another php page and put it in a text box when you typed something into antoher text box.

    I mainly use PHP but i'm going to try and learn the basics of ajax/js so i'll have enough to get me over the line.

    I know general javascript but I suppose it's using DOM to control elements of the page is where I fall down. This is probably where I should start..


Advertisement