wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Changing the target of a form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Changing the target of a form" Watch "Changing the target of a form" New topic

Changing the target of a form

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I need to change the target of a form.. How would this be done. ??

What's this H2SO4 doing in my fridge?? ( thud )

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Sri Nivas
Ranch Hand

Joined: Apr 18, 2001
Posts: 58
if u need to change the target to which the form is posted dynamically, then u can do it with javascript.
Connie Boyd
Ranch Hand

Joined: Feb 22, 2001
Posts: 73
Do you need to change the action, or the target? Srini's code above changes the action of the form, but if you're trying to send the results of a form to a different frame or window, you could do it by adding the target attribute like so:
<FORM ACTION="MyAction" METHOD="POST" TARGET="ResultsFrame">
Where the target is the name of the frame or window you want the results to be sent to.

[This message has been edited by Connie Boyd (edited May 16, 2001).]
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I want to change the target.... not the action. How can I change that in JavaScript. I need it to be dynamic in that way.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Use this form:
document.myForm.target = "windowName"
That will change the target of the form.
hope that helps

I agree. Here's the link: http://aspose.com/file-tools
subject: Changing the target of a form
Similar Threads
jsp forwarding to a target frame
Problem with Target Attribute
targeting the client frame
Refreshing a JSP in the lower frame using a servlet
for loop nesting