Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get info from one form into another?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have 2 forms on one page (a 'Submit' form and a 'Cancel' form).
I use hidden fields for the Cancel form.
Is there a way to get what the user types into a textarea in the Submit form and use it for the Cancel form?
I assume some type of JS is used for this, but I am not sure.
Basically, I'll have one 'Comments' field for both forms.
THANKS!!
 
sure, set the value of area 2 to the value of area 1:

<body>
<form>
<textarea name=&quot;area1&quot; onchange=&quot;document.forms[1].area2.value = this.value;&quot;></textarea>
</form>
<form>
<textarea name=&quot;area2&quot;></textarea>
</form>
</body> ======================================

if (!succeed) try++
-jeff
 
Hi newbie

This can, of course, be done but, isn't it a little sneaky? If the user cancels, they have decided that they do not wish you to have the information that they placed there. Unless, of course, you are telling them that you are cancelling but you are just going to copy the info and send it anyway? Cheers
Keith
Administrator - javascriptcity.com
 
it's not sneaky, i am working on an intranet form for requests to the IS dept.
I need a common Comments field, so if the guy wants to authorize the request, he can fill in some additional info. If he wants to cancel, then he can fill in the reason(s) why..that's all!
 
for the '....forms[1]...' part, should i use as is, or sub in my form name?
 
hi newbie,

the &quot;...forms[1]...&quot; refers to form # 2 in your page, provided you are really using two (or more) <form> tags. You could also use the name of the form (if you name it):

document.formName...

======================================

if (!succeed) try++
-jeff
 
this is what i'm using:
Form1:
msgText1 = msgText1 + &quot;<b>Comments</b><br><textarea name = Reason cols='40' rows='3' wrap='soft' onChange='document.cancel.Reason2.value = this.value;'></textarea>&quot;;

Form2:
String reason = req.getParameter(&quot;Reason2&quot;);
msgText1 = msgText1 + &quot;\r\nReason for Cancellation: &quot; + reason;

This is a java servlet.
I do not get a value for the Form2 part (just a blank is returned).
 
oops!
form2 is:

msgText1= msgText1 +&quot;<input type = hidden name = Reason2>&quot;;

(the other part i posted was the servlet that handles the data for the Cancel form)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top