Update textbox with found result!

M

millw0rm

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!
 
N

Nick

[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.
 
M

millw0rm

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;
}
 
R

Randy Webb

(e-mail address removed) 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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top