Results 1 to 2 of 2
  1. #1

    Form Field and JavaScript...

    Hello,
    I am not sure if this is the place to post this question, but I thought that I would give it a shot...If there is a better place to post this queiston, please advise...

    I have a form that I am working on....I have several text fields and one hidden field...

    Is there anyway of making the hidden field 'value' equal to one of the entries that some one puts into a text field?? In otherwords...

    <input type="text" name="id_1" size=25>
    <input name="id_2" type="hidden" value="I Want this equal to the 'id_1' value that is entered" size=25>

    Thanks for any help....Maybe this is a small java script problem...
    thx
    Mike

  2. #2
    you can do it like this:

    <form name=myform>
    <input type=hidden name=hiddenField value="this value is hidden">
    <input type=text name=newValue value="Hi there">
    <input type=button value="Change it" onclick="textToHidden()">
    </form>

    <script>
    alert("Hidden field value is: "+document.myform.hiddenField.value);

    function textToHidden()
    {
    document.myform.hiddenField.value = document.myform.newValue.value;
    alert("Hidden field value changed to: "+document.myform.hiddenField.value);
    }
    </script>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •