SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: auto complete

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    auto complete

    In an earlier post there was a reference to this site:
    http://capxous.com/
    CAPXOUS : AJAX autocomplete / autosuggest component

    I got an auto complete box working (single box), but the example where you choose a name and several other fields are auto filled on a form I couldn't figure out how this is done. This example is "Demo 2: CIA Officer AutoComplete By Name & ID" Please if anyone knows how this is done please reply, this is the main thing I have been trying to accomplish. The site gives no tutor on this example.

  2. #2
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The site has a pretty decent tutorial on how to get started with their product:

    http://capxous.com/docs

    There are other autocomplete solutions out there including scriptaculous and YUI (among others) that are documented pretty well.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I got a "single" box working

    I have already read the docs and got a "single" (by itself) autocomplete box working. I didn't see any docs on filling the other form fields once a selection is made in the dropdown. This is what I am trying to learn. Not the basic example, but the one called: Demo 2: CIA Officer AutoComplete By Name & ID. On the other sites you suggested, all they show is a single autocomplete dropdown, but I can do this already. I want to learn how to fill the other fields.

  4. #4
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used firebug to see what data is coming back from the Ajax request. Here's what I found (line spacing added):
    HTML Code:
    <div onSelect="this.text.value='Sydney Bristow';
      $('code').innerHTML = '001';
      $('fullname').innerHTML = 'Sydney Bristow';
      $('affiliations').innerHTML = 'SD-6, CIA, APO';
      $('heldranks').innerHTML = 'SD-6 field agent, CIA field agent, APO field agent';">
      <span class='informal'>(001)</span>
      <span>Sydney Bristow</span>
    </div>
    <div onSelect="this.text.value='Jack Bristow';
      $('code').innerHTML = '002';
      $('fullname').innerHTML = 'Jack Bristow';
      $('affiliations').innerHTML = 'SD-6, CIA, APO';
      $('heldranks').innerHTML = 'SD-6 senior partner, CIA senior officer, Director of APO';">
      <span class='informal'>(002)</span>
      <span>Jack Bristow</span>
    </div>
    That all comes from their Ajax server:
    http://capxous.com/agency.php?q=bri

    So, the php code is spitting out prototype commands within the onselect event of the div so that the other form fields are filled in when you choose the item.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •