Solved

Submit a form action to new target ???

Posted on 2003-10-31
6
1,521 Views
Last Modified: 2008-03-10
I have a function that sets hiddden fields in a form and submits it. The thing is I want to have the page it submits to come up in a separate window , not the same window. How do I do this???

//////////////////////////
Code sample
/////////////////////////

function submitForm(event, action, cValue, courseName){

      document.catalog.eventType.value = event;
      document.catalog.actionType.value = action;
      document.catalog.cValue.value = cValue;
      document.catalog.courseName.value = courseName;      
      document.catalog.submit();
      return false;
}
// End hiding script from old browsers -->
</script>

<br>
<div class="PageTitle">Brocade Course Catalog</div>
<br>
<FORM NAME='catalog' METHOD='POST' ACTION='http://www.brocade.com/gtms/education_services'>
<INPUT TYPE = 'HIDDEN' NAME = 'eventType' VALUE = ''>
                  <INPUT TYPE = 'HIDDEN' NAME = 'actionType' VALUE = ''>
                  <INPUT TYPE = 'HIDDEN' NAME = 'cValue' VALUE = ''>
                  <INPUT TYPE = 'HIDDEN' NAME = 'cValue1' VALUE = ''>
                  <INPUT TYPE = 'HIDDEN' NAME = 'courseName' VALUE = ''>
0
Comment
Question by:894359
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 18

Assisted Solution

by:bobbit31
bobbit31 earned 200 total points
ID: 9659454
<FORM NAME='catalog' METHOD='POST' ACTION='http://www.brocade.com/gtms/education_services' TARGET=_blank>
0
 
LVL 10

Accepted Solution

by:
NetGroove earned 300 total points
ID: 9659473
Either set in <form> tag the target:

<FORM NAME='catalog' METHOD='POST' ACTION='http://www.brocade.com/gtms/education_services'  TARGET="_new">


Or assign it in your JavaScript function:

     document.catalog.target = "_new";
     document.catalog.submit();
    return false;
}

If you have already a window, then assign to that window a name and use the name as target.


0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9659506
To assign your other window a name use this script:

<script>
window.name = "myWin";
</script>

So you can target to that window:

    document.catalog.target = "myWin";
    document.catalog.submit();
   return false;
}

Or you open a new window and give it  a name like this:

    newWin = window.open("",  "myWin", "height=100,width=100");
    document.catalog.target = "myWin";
    document.catalog.submit();
   return false;
}






0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:894359
ID: 9659542
For some reason the target="_new" in the page works but the submitting page reloads and I get an error (jsp page). I tried both methods and the both launch a new window fine but the page with the  form submission code reload?  I can't have this!
0
 

Author Comment

by:894359
ID: 9659590
I fixed it! It was because I had the funtion returning false. I just removed it!
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9659665
Thanks for the points.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question