greddin
asked on
How can I copy one form element's value to another?
I have a page that has a primary form. In this form is a hidden field called "comments".
(See sample below)
When form1 is submitted how can I copy the "mycomments" value into the the hidden field "comments".
(See sample below)
When form1 is submitted how can I copy the "mycomments" value into the the hidden field "comments".
<textarea cols="30" rows="4" name="mycomments"></textarea>
<form name="form1">
<input type="hidden" name="comments">
<input type="hidden" name="id">
</form>
ASKER
Well, I'm not sure I understand. Below is more of how my code appears. As you can see the textarea is not in a form. I would just like a function that gets called when "theForm" is submitted that copies the value from the "mycomments" textarea into the hidden field "comments".
Could you help with a function that does this?
Could you help with a function that does this?
<html>
<body>
Your comment:
<textarea cols="20" rows="4" "mycomments"></textarea>
<form name="theForm">
<input type="hidden" name="comments">
<input type="submit">
</form>
</body>
</html>
Sorry, my bad, just tried to show an example of how values can be copied. Can you tell me if there a possibility to copy the value on the server side or you need it on client side only?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you xakem for going the extra step to show me.
Open in new window