PDA

View Full Version : passing text


blurchy
7-9-02, 09:10 AM
hi

does anyone know how to pass text from one textfeild

to another

eg : you type hello in one text box press a button and it appears

in the other text box


the simpler the better :)

rainbore
7-9-02, 12:10 PM
Hi blurchy,

You'll need some JavaScript to pass the contents of one form element to another.

<INPUT TYPE="TEXT" NAME="box1" SIZE="30">
<INPUT TYPE="TEXT" NAME="box2" SIZE="30">
<INPUT TYPE="BUTTON" NAME="mover" VALUE="Copy Text" onClick="this.form.box2.value=this.form.box1.value;">


Pressing the button will copy the contents of the element "box1" into "box2" (unless my on-the-fly coding here is flawed). If you need to error-check the text before moving it, or if you are moving text between separate <FORM>s you'll need some independent JavaScript rather than a simple button. If you could explain your need a bit more, I could provide examples. Good luck!

Richard L. Trethewey
www.rainbo.net

blurchy
7-9-02, 01:25 PM
HI

thats brilliant exactly what i needed

ive always wanted to know how that was done

gees the code seems so simple now

but i tried and tried and hadnt a clue

all i wanted to do was use that code to make

links like so

<form name="form1" method="post" action="">
<textarea name="box1" cols="30"><a href="http://www.nameofsite.com">nameoflinkhere</a></textarea>
<input type="TEXT" name="box2" size="30">
<input type="BUTTON" name="mover" value="Copy Text" onClick="this.form.box2.value=this.form.box1.value;">
</form>


a link maker basically


just something to make tags

or even a mini html editor

at some point

thanks thats made my day :)

p.s. nice site