In html page I have two forms:

<form name=fm1 method=post action=aaa.html>
<input type=text name=a1>
<textarea name=a2></textarea>
<input type=submit>
</form>

<form name=fm2 method=post action=bbb.html>
<input type=text name=b1>
<input type=submit>
</form>

Now the question is if I submit "fm2", is it possible to also submit the text area which is in "fm1"? I don't want to repeat the same text area in both "fm1" and "fm2", so this text area can either submit to "fm1", or "fm2".

Thanks for any help.

Hi there,

Well I didn't seen any direct way to do this, but you can use the, there may have a hidden field in fm2 for storing the value of textarea (fm1) and use this very very simple function to fill the value in hidden field.

<html>
<head>
<title> </title>
<script type="text/JavaScript">
<!--
Function filldata () { 
document.fm2.b3.value = document.fm1.a2.value;
}
//-->
</script>
</head>
<body>
<form name="fm1" method="post" action="aaa.html">
<input type="text" name="a1">
<textarea name="a2" onblur="filldata()"></textarea>
<input name="Submit" type=submit value="Submit">
</form>

<form name="fm2" method="post" action="bbb.html">
<input type="text" name="b1">
<input name="b3" type="hidden" value="" />
<input name="Submit" type="submit" value="Submit">
</form>
</body>
</html>

I hope it may help you,

Best Regards,
Rahul Dev

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.