Connecting Tech Pros Worldwide Help | Site Map

Transfer / copy data between textboxes

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 11:22 AM
Øyvind Isaksen
Guest
 
Posts: n/a
Default Transfer / copy data between textboxes

I have 2 textboxes (textbox1 and textbox2) and one hidden field
(hidden). I want the value of the hidden field to be both values of
textbox1 and textbox2 separated with "-".

Example:
textbox1 = "15"
textbox2 = "25"
Hidden = "15-25"

Hope someone can help me!!!

Regards
Øyvind Isaksen

  #2  
Old July 23rd, 2005, 11:22 AM
Vincent van Beveren
Guest
 
Posts: n/a
Default Re: Transfer / copy data between textboxes

This should do it

<FORM NAME="formname">

<INPUT TYPE="text" NAME="textbox1" onChange="copy();">
<INPUT TYPE="text" NAME="textbox2" onChange="copy();">
<INPUT TYPE="hidden" NAME="hidden">
</FORM>

<SCRIPT LANGUAGE="JavaScript">
function copy() {
from = document.forms['formname'];
form.hidden.value = form.textbox1.value+'-'+form.textbox2.value;
}
</SCRIPT>

Good luck,
Vincent

Øyvind Isaksen wrote:[color=blue]
> I have 2 textboxes (textbox1 and textbox2) and one hidden field
> (hidden). I want the value of the hidden field to be both values of
> textbox1 and textbox2 separated with "-".
>
> Example:
> textbox1 = "15"
> textbox2 = "25"
> Hidden = "15-25"
>
> Hope someone can help me!!!
>
> Regards
> Øyvind Isaksen[/color]

  #3  
Old July 23rd, 2005, 11:22 AM
Shawn Milo
Guest
 
Posts: n/a
Default Re: Transfer / copy data between textboxes

oyvind@webressurs.no (Øyvind Isaksen) wrote in message news:<3e68cc33.0406022208.321b1e45@posting.google. com>...[color=blue]
> I have 2 textboxes (textbox1 and textbox2) and one hidden field
> (hidden). I want the value of the hidden field to be both values of
> textbox1 and textbox2 separated with "-".
>
> Example:
> textbox1 = "15"
> textbox2 = "25"
> Hidden = "15-25"
>
> Hope someone can help me!!!
>
> Regards
> Øyvind Isaksen[/color]



Something like:

<script type="text/javascript">

document.forms[formName].hiddenBox.value =
document.forms[formName].text1.value + '-' +
document.forms[formName].text2.value;

</script>


Shawn
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.