SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Catching Ajax Events on complex form

    Let's say you have a customer entry form, with the following data;

    # could be a database or anything, doesn't matter right now
    Array {
    "Joe Bloggs", 18, 20000,
    "Sally Smith", 20, 22000
    }
    We have an input box; ala Google Select, which will get the person, but it must also fill in the rest of the form.

    What we're trying to understand is, how to capture events such as onclick, onkey (any events)...

    So,


    [INPUT BOX] <-- put your text entry in here

    [AGE] <-- text box is automatically filled in
    [WAGE] <-- text box is automatically filled in
    Also, how to stop recording for events too.

    Is there any demos of complex form + google select examples?

    Many thanks.

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I have worked with both of these issues before. Without going into insane detail....

    Look into these methods

    textCell.selectionStart
    textCell.createTextRange

    These will get you started with the google select type thing(You are in trouble if you need Safari though)

    For the auto fill, I usually use onblur

    If you have an element like a textbox I use the onblur, but you can substitute with on click as well

    <input type = "text" id = "name" onblur = "javascriptFunction(this)">

    function javascriptFunction(textBox){
    //if you want this textBox to stop recording the event..your in for fun. Check out these 3 //different ways and their browser compatabilities
    textBox.onblur = "";
    textBox.onblur = new function(){//do nothing};
    textBox.removeAttribute("onblur");
    }

    Well, gl hope this answered some of your questions

    AFrieze
    Last edited by AFrieze; Jul 14, 2006 at 07:32.

  3. #3
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for your help, I really appreciate it.


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
  •