Transfer / copy data between textboxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Øyvind Isaksen

    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
  • Vincent van Beveren

    #2
    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="JavaS cript">
    function copy() {
    from = document.forms['formname'];
    form.hidden.val ue = form.textbox1.v alue+'-'+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]

    Comment

    • Shawn Milo

      #3
      Re: Transfer / copy data between textboxes

      oyvind@webressu rs.no (Øyvind Isaksen) wrote in message news:<3e68cc33. 0406022208.321b 1e45@posting.go ogle.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.valu e =
      document.forms[formName].text1.value + '-' +
      document.forms[formName].text2.value;

      </script>


      Shawn

      Comment

      Working...