By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,070 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,070 IT Pros & Developers. It's quick & easy.

Transfer / copy data between textboxes

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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:
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


Jul 23 '05 #2

P: n/a
oy****@webressurs.no (Řyvind Isaksen) wrote in message news:<3e**************************@posting.google. com>...
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
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.