473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

is it possilble that a <form> dont open a new window

Hi,

I try to make when i send a <form> that he dont open a new window. Is there
someone who know how i can make this whit javascript ?

Greets Wouter
Jul 24 '05 #1
19 2866
Wouter wrote:

Hi,
I try to make when i send a <form> that he dont open a new window. Is there
someone who know how i can make this whit javascript ?


Generally a form does not open a new window when submitted, if it does
then you either have a "target" attribute in your form opening tag or a
"target" property defined in scripting - just remove it and the form
will be submitted in the current window, as you wish.
HTH,
Yep.
Jul 24 '05 #2
Wouter wrote:
I try to make when i send a <form> that he dont open a new window.
The default behavior of forms is to submit to the same window.
Is there someone who know how i can make this whit javascript ?


You don't need JavaScript to make the default happen. You have to take
explicit steps to change the behavior from the default.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #3
>
Generally a form does not open a new window when submitted, if it does
then you either have a "target" attribute in your form opening tag or a
"target" property defined in scripting - just remove it and the form will
be submitted in the current window, as you wish.


Sorry i forgot to say i need a target because the form is using for login a
forum

Greets Wouter
Jul 24 '05 #4
Wouter wrote:
Generally a form does not open a new window when submitted, if it does
then you either have a "target" attribute in your form opening tag or a
"target" property defined in scripting - just remove it and the form will
be submitted in the current window, as you wish.
Sorry i forgot to say i need a target because the form is using for login a
forum


If you mean that you have a popup window as entry point to your forum,
and want that the loaded form be in the main window, then try adding a
target="_top" in the login form, in the popup.

Otherwise could you post some code exemplifying your issue?
Thanks,
Yep.

Jul 24 '05 #5
Wouter wrote:
Sorry i forgot to say i need a target because the form is using for login
a forum


Why? The sole purpose of the target attribute is to determine which
window/frame the document will load in. It has no effect on what data is
sent to the server, so it can't be required because it is being used for a
login form.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #6
> Otherwise could you post some code exemplifying your issue?


I'm dont use a popup.

<FORM action="http://test.mydomain.com/forum/login.php" method="post"
target="main">
<INPUT class="post" size="12" name="username" value="Username">
<INPUT class="post" type="password" size="12" name="password"
value="Password">
<input type="hidden" name="redirect" value="redirect.php?url=<?php echo
$url; ?>">
<INPUT class="text" type="checkbox" name="autologin"></td>
<input class="mainoption" type="submit" value="Inloggen"
name="login">

Greets WOuter
Jul 24 '05 #7
Wouter wrote:
<FORM action="http://test.mydomain.com/forum/login.php" method="post"
target="main"> <input type="hidden" name="redirect" value="redirect.php?url=<?php echo
$url; ?>">

I'm sorry I still cannot get the pattern you're using. Do you have
frames, as one could understand from "target=main"? What is the role of
the hidden control?

What happens if you remove target="main"? If you remove the input
type="hidden"?
Thanks,
Yep.
Jul 24 '05 #8
> I'm sorry I still cannot get the pattern you're using. Do you have frames,
as one could understand from "target=main"? What is the role of the hidden
control?
The target main is needed by the forum. otherwise he dont cant login.
What happens if you remove target="main"? If you remove the input
type="hidden"?


The hidden field does a redirect to page where the user login. otherwise he
will see the index of the forum

Greets Wouter
Jul 24 '05 #9
Wouter wrote:
I'm sorry I still cannot get the pattern you're using. Do you have
frames, as one could understand from "target=main"? What is the role of
the hidden control?


The target main is needed by the forum. otherwise he dont cant login.


Why not?

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #10

"Wouter" <laptop@_NOSPAM.com> wrote in message
news:42***********************@news.wanadoo.nl...
Hi,

I try to make when i send a <form> that he dont open a new window. Is there someone who know how i can make this whit javascript ?

Greets Wouter

lol!
Jul 24 '05 #11
>>
The target main is needed by the forum. otherwise he dont cant login.


Why not?

I dont know ecactely why because its a phpbb forum and the code are
sometimes deficalt to read. But when i delete the target main i cant login
anymore.

Greets Wouter
Jul 24 '05 #12
Wouter wrote:
The target main is needed by the forum. otherwise he dont cant login.
Why not?

I dont know ecactely why because its a phpbb forum and the code are
sometimes deficalt to read. But when i delete the target main i cant login
anymore.


We're not getting anywhere here, do you have an online URL demonstrating
the problem? Without reproducing the steps and undertanding the issue
it's hard to give you correct advice.

Currently, what we have is:
- you have a popup that is opened in result of the form submission,
while you would like to not have any popup,
- this behavior is probably due to the target attribute of the FORM,
which points to something called "main" - since you don't have any frame
called "main" it opens a popup,
- if there's no target the login does not work - what happens here, what
do you mean by "can't login anymore"? Do you have any error message?
Thanks,
Yep.
Jul 24 '05 #13
> We're not getting anywhere here, do you have an online URL demonstrating
the problem? Without reproducing the steps and undertanding the issue it's
hard to give you correct advice.

Currently, what we have is:
- you have a popup that is opened in result of the form submission, while
you would like to not have any popup,
- this behavior is probably due to the target attribute of the FORM, which
points to something called "main" - since you don't have any frame called
"main" it opens a popup,
- if there's no target the login does not work - what happens here, what
do you mean by "can't login anymore"? Do you have any error message?


Yes you can see it online.

check: http://webshop.addrenaline.com/conte...en/algemeen/0/
if you want to login you can use as pass and login: usenet

Greets Wouter
Jul 24 '05 #14
Wouter wrote:
check: http://webshop.addrenaline.com/conte...en/algemeen/0/
if you want to login you can use as pass and login: usenet


Thanks this is clearer now.

The approach in your page is dependent on javascript, which means that
if your user does not have javascript activated, it will fail. Moreover,
it's dependent on popups, which may be blocked by popup blockers.
Therefore, if you have the chance, I suggest you drop the popup thing
and include the login/password fields directly in the main page.

Now, if you want to keep this popup approach, then update the main file
and the popup file with the following patterns.
--- main file ---
<script type="text/javascript">
self.name="main";
</script>

<a href="login.html"
target="popup"
onclick="loginPopup=window.open(this.href, this.target)">Login</a>
---
--- popup file ---
<form action="doLogin.html"
target="main"
onsubmit="setTimeout(function(){window.close()},1) ;return true">
<input type="submit">
</form>
---
HTH,
Yep.
Jul 24 '05 #15

"Yann-Erwan Perio" <ye*@invalid.com> schreef in bericht
news:42***********************@news.free.fr...
Wouter wrote:
check: http://webshop.addrenaline.com/conte...en/algemeen/0/
if you want to login you can use as pass and login: usenet
Thanks this is clearer now.

The approach in your page is dependent on javascript, which means that if
your user does not have javascript activated, it will fail. Moreover, it's
dependent on popups, which may be blocked by popup blockers. Therefore, if
you have the chance, I suggest you drop the popup thing and include the
login/password fields directly in the main page.


Thats a good point i dont think about that! But when i include the
login/pass fields in de main site then i have a other problem that i need to
close the window where the user enter his login/pass....
I think i most go to learn mutvh better javascript! :) I think i will try to
make this but the javascript is again a problem i think because i dont know
how i close a window behind...
Now, if you want to keep this popup approach, then update the main file
and the popup file with the following patterns.
Thx for the code! But i will first to try to get everything on the main page
:)

HTH,
Yep.


Greets Wouter
Jul 24 '05 #16
Now, if you want to keep this popup approach, then update the main file
and the popup file with the following patterns.

Thx for the code! But i will first to try to get everything on the main
page :)


I have make fast a login on the main page and it works fine only when i
close the window i get a messages i i'm sure i want to close the window. So
thats why i want to know i it polibele whit javascript to send a form whit a
target in the same window.

Greets Wouter
Jul 24 '05 #17
Wouter wrote:
I have make fast a login on the main page and it works fine only when i
close the window i get a messages i i'm sure i want to close the window.
This is a security feature, you can only close a window that you have
opened, not the main window.
So
thats why i want to know i it polibele whit javascript to send a form whit a
target in the same window.


If everything is on the main window, then you don't need any target
anymore, just remove the window.name stuff and the target (or define it
to "_self") and this should work.

When working with specific issues it's always better to write a
dedicated test case, since you don't have to keep in view details
irrelevant to your test - if you have a hard time having it work, then
simplify your test case until you really just have the points you want
to validate.
HTH,
Yep.
Jul 24 '05 #18
Yann-Erwan Perio wrote:
If everything is on the main window, then you don't need any target
anymore, just remove the window.name stuff and the target (or define it
to "_self") and this should work.


And of course remove the self.close() call, since you're working with
one window you don't want to close it.
Cheers,
Yep.
Jul 24 '05 #19
If everything is on the main window, then you don't need any target
anymore, just remove the window.name stuff and the target (or define it to
"_self") and this should work.


It look like that everything is on the main window. But the send the data to
/forum/login.php and after login he redirect to /forum/redirect.php and that
file checks from where the user wants to login and redirect him then to the
place where the user clicks login.

But the target needs PHPbb so i cant delete the target.

Greets Wouter
Jul 24 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Michael Hamm | last post by:
Hi, I'm trying to write a <form> whihc will retrieve a Web page on another server. I have (essentially) this: <form action="http://cgi.cs.indiana.edu/~oracle/digest.cgi"> <input...
2
by: Keiron Waites | last post by:
I have the following code: <input type="text" name="search" class="search_top"> <a href="" onclick="window.location='search.inc.php'+document..search. value; return false;"...
3
by: Ben | last post by:
Here's my form: <form name="aForm" method='post'> <input type=file name=file1 onkeypress='KeyPress()'><br> <a id='attachMoreLink' href='javascript:AddFileInput()">Attach More Files </a> <input...
4
by: Howard Jess | last post by:
In Opera 8.01 (Linux; Build 1204) and in Opera 7.54 (Windows XP; Build 3865), my form disappears from the HTML markup (below). To summarize: 1) In a <script> block in the <head> I create a form...
4
by: rob c | last post by:
This is a minor thing and only appears in IE (so far), but I'd like to know to correct it (if possible). Whenever I use a form on a webpage, Explorer always leaves a blank line following the...
19
by: Coward 9 | last post by:
HI, I saw in an example hello.aspx, there is a <form tagbeing used like <form runat="server> I search all html tag references and could NOT find "runat" attributes for <formtag. which...
5
by: shotokan99 | last post by:
for instance i do have this element but i dont have a <form>: <input type="Text" name="myname" id="myname" size="30"...> then i have this link: echo'<a...
10
by: neverquit | last post by:
hi , Iam Nagesh,Begineer in using Ajax,well i have been using ajax in application, i have faced a problem while placing the responseTEXT into the <div> tag positioned inside the <form> tag iam...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.