Solved

Submit a form action to new target ???

Posted on 2003-10-31
6
1,522 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

626 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