Transfer / copy data between textboxes

  • Thread starter Øyvind Isaksen
  • Start date
Ø

Øyvind Isaksen

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
 
V

Vincent van Beveren

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
 
S

Shawn Milo

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



Something like:

<script type="text/javascript">

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

</script>


Shawn
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top