Update textbox with found result!

Discussion in 'Javascript' started by millw0rm@gmail.com, Nov 29, 2005.

  1. Guest

    I got a textbox with name = action, whn a key is press (eg. 'm') it
    sends a query to database grabs data from server n send data back
    keywords found, each keyword got a function called
    newValue(found_keyword), when clicked, it replaces the text in the
    textbox...
    function newValue(mysql) => textbox => action = > value => from 'm' is
    replaced with the word 'mysql'


    Then the user adds '+' and tries for second keyword [ j ]

    javascript splits the keyword which is '+' delimited (ie. mysql + j)
    and [ j ] is sent to the script, script look for ne word start with the
    word [ j ] n returns the results, with the function newValue(JScript)
    same as above...

    now the problem coms.. on clicking on [ JScript ] the value in the
    textbox (ie. mysql + J) gets replaced with [JScript]...

    What i want is, it shld remove the letter [ j ] and add 'JScript'
    instead of that! Final result shld look like [mysql + JScript]

    u try 'http://del.icio.us/ => post to del.icio.us' n see how the tags
    field works! Then u wil understand wat i mean!

    Codes:
    function newValue(str) {
    document.form1.action.value = str;
    }

    App URL : http://aquaciti.com/example/index.php

    Try searching for 1 keyword [a] when found click on it, it will be
    added to textbox then put '+' and look for other keyword [h] when found
    click on the second keyword!
     
    , Nov 29, 2005
    #1
    1. Advertising

  2. Nick Guest

    wrote:
    > [blah]
    > now the problem comes.. on clicking on [ JScript ] the value in the
    > textbox (ie. mysql + J) gets replaced with [JScript]...
    >
    > What i want is, it shld remove the letter [ j ] and add 'JScript'
    > instead of that! Final result shld look like [mysql + JScript]
    >
    >
    > App URL : http://aquaciti.com/example/index.php


    document.all is IE only so this won't work in other browsers at the
    moment, use document.getElementById() to make sure this is cross browser.

    As for it replacing the text, it should be clear that that's what you're
    doing here

    document.all.foo.innerHTML = http.responseText;

    You want to append http.responseText to the end of innerHTML instead,
    perhaps getting a substring of it in order to strip off the 'J' already
    typed.
     
    Nick, Nov 29, 2005
    #2
    1. Advertising

  3. Guest

    well i dont want to replace the text in "document.all.foo.innerHTML"
    instead in want it to be replace in textbox called "action" thats wat
    the function NewValue(str) does!

    function newValue(str) {
    document.form1.action.value = str;
    }
     
    , Nov 29, 2005
    #3
  4. Randy Webb Guest

    said the following on 11/29/2005 7:14 AM:

    Please quote what you are replying to.

    If you want to post a followup via groups.google.com, don't use the
    "Reply" link at the bottom of the article. Click on "show options" at
    the top of the article, then click on the "Reply" at the bottom of the
    article headers.

    > well i dont want to replace the text in "document.all.foo.innerHTML"
    > instead in want it to be replace in textbox called "action" thats wat
    > the function NewValue(str) does!
    >


    Put the value of your text input into a variable, search and replace
    what you want replaced with the new text and then set the value of your
    input field.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Nov 29, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J.Ram
    Replies:
    7
    Views:
    661
  2. Pavel
    Replies:
    7
    Views:
    547
    Pavel
    Sep 19, 2010
  3. Lakshmi Sreekanth

    i = 10; result = ++i - --i; How result become ZERO

    Lakshmi Sreekanth, Sep 21, 2010, in forum: C Programming
    Replies:
    52
    Views:
    1,205
    Nick Keighley
    Sep 23, 2010
  4. Mr. Buffoon
    Replies:
    4
    Views:
    340
    Eric Sosman
    Sep 23, 2010
  5. Michael Tan
    Replies:
    32
    Views:
    1,025
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page