File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Form within form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Form within form" Watch "Form within form" New topic

Form within form

pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
Hello Ranchers ,
I have a form within a form ( please dont ask me why - but essentially
there is a huge jungle of HTML code and Java script that I need to maintain ) so thats the way it is .
Thanks for bearing with me .

Here is what I need to do :
There is a text area in the second form
I need to highlight some text in the text area of the second form
Then when I click a button ( in the first form ) I need to append some text prior to the highlighted text .

This works fine if the text area and the buttons are in the same form
but not when the text area is in the other form .

Here is the code that I have :

Can someone please help me out ?

Thanks in advance ,
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33134

In this example, you have two forms one after another. Not a form within a form (luckily.)

You can use an absolute path type structure to access the textarea. For example, document.form2.txtArea2.value += "new stuff";

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
pendse anagha
Ranch Hand

Joined: Mar 09, 2005
Posts: 44
Hello Jeanne ,
My mistake - I typed it incorrectly

I do have a form within a form .

Here is the corrected code :
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
By the rules on HTML, you can not have a form inside of a form and have it function correctly.....

What is the purpose of the two forms?

I agree. Here's the link:
subject: Form within form
It's not a secret anymore!