• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5199
  • Last Modified:

FORM submit in the same window and <BASE Target="_blank">

I have a webpage with lots of links which should open in new windows. I add <BASE Target="_blank"> to avoid inserting  Target="_blank"  in each "<A HREF" tag. But now a search :
   <form action="cgi-bin/search.pl" method="GET">
      <input type="text">
      <INPUT TYPE="submit" value="Search">
will also open in a new window. How can I avoid that a new window opens if I click on this submit button?

Thank you, Ben
2 Solutions
add target="_self" to the form-tag

<form action="cgi-bin/search.pl" method="GET" target="_self">
Renante EnteraSenior PHP DeveloperCommented:
Hello there!

I had an advice for you.  You better disable your submit button once it is click to avoid multiple submit to happen.

So instead of this line :

    <form action="cgi-bin/search.pl" method="GET"> and <input type="submit" value="Search">

Replace it with :

    <form name="form1" action="cgi-bin/search.pl" method="GET" OnSubmit="return DisableSubmit();">
    <input type="submit" name="Search" value="Search">

Then here is the javascript function for DisableSubmit() :
  function DisableSubmit()
    document.form1.Search.disabled = true;
    return true;

Goodluck !
eNTRANCE2002 :-)
bengoreAuthor Commented:
Thank you for your help (and the advice)!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now