Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old July 24th, 2005, 11:15 AM
Wouter
Guest
 
Posts: n/a
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


  #2  
Old July 24th, 2005, 11:15 AM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:

Hi,
[color=blue]
> 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 ?[/color]

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.
  #3  
Old July 24th, 2005, 11:25 AM
David Dorward
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue]
> I try to make when i send a <form> that he dont open a new window.[/color]

The default behavior of forms is to submit to the same window.
[color=blue]
> Is there someone who know how i can make this whit javascript ?[/color]

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
  #4  
Old July 24th, 2005, 11:35 AM
Wouter
Guest
 
Posts: n/a

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


>[color=blue]
> 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.
>[/color]

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

Greets Wouter


  #5  
Old July 24th, 2005, 11:55 AM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue][color=green]
>>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.[/color][/color]
[color=blue]
> Sorry i forgot to say i need a target because the form is using for login a
> forum[/color]

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.

  #6  
Old July 24th, 2005, 11:55 AM
David Dorward
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue]
> Sorry i forgot to say i need a target because the form is using for login
> a forum[/color]

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
  #7  
Old July 24th, 2005, 12:25 PM
Wouter
Guest
 
Posts: n/a

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


> Otherwise could you post some code exemplifying your issue?[color=blue]
>[/color]

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


  #8  
Old July 24th, 2005, 01:05 PM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue]
> <FORM action="http://test.mydomain.com/forum/login.php" method="post"
> target="main">[/color]
[color=blue]
> <input type="hidden" name="redirect" value="redirect.php?url=<?php echo
> $url; ?>">[/color]


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.
  #9  
Old July 24th, 2005, 01:05 PM
Wouter
Guest
 
Posts: n/a

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


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

The target main is needed by the forum. otherwise he dont cant login.
[color=blue]
> What happens if you remove target="main"? If you remove the input
> type="hidden"?[/color]

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

Greets Wouter


  #10  
Old July 24th, 2005, 01:25 PM
David Dorward
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue][color=green]
>> 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?[/color]
>
> The target main is needed by the forum. otherwise he dont cant login.[/color]

Why not?

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #11  
Old July 24th, 2005, 02:25 PM
cosmic foo
Guest
 
Posts: n/a

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



"Wouter" <laptop@_NOSPAM.com> wrote in message
news:42e3682d$0$22507$dbd4d001@news.wanadoo.nl...[color=blue]
> Hi,
>
> I try to make when i send a <form> that he dont open a new window. Is[/color]
there[color=blue]
> someone who know how i can make this whit javascript ?
>
> Greets Wouter
>
>[/color]


lol!


  #12  
Old July 24th, 2005, 05:15 PM
Wouter
Guest
 
Posts: n/a

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


>>[color=blue][color=green]
>> The target main is needed by the forum. otherwise he dont cant login.[/color]
>
> Why not?
>[/color]
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


  #13  
Old July 24th, 2005, 05:35 PM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue][color=green][color=darkred]
>>>The target main is needed by the forum. otherwise he dont cant login.[/color]
>>
>>Why not?[/color][/color]
[color=blue]
> 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.[/color]

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.
  #14  
Old July 24th, 2005, 05:55 PM
Wouter
Guest
 
Posts: n/a

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


> We're not getting anywhere here, do you have an online URL demonstrating[color=blue]
> 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?
>[/color]

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


  #15  
Old July 24th, 2005, 06:45 PM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue]
> check: http://webshop.addrenaline.com/conte...en/algemeen/0/
> if you want to login you can use as pass and login: usenet[/color]

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.
  #16  
Old July 24th, 2005, 07:25 PM
Wouter
Guest
 
Posts: n/a

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



"Yann-Erwan Perio" <yep@invalid.com> schreef in bericht
news:42e3d231$0$15059$626a14ce@news.free.fr...[color=blue]
> Wouter wrote:
>[color=green]
>> check: http://webshop.addrenaline.com/conte...en/algemeen/0/
>> if you want to login you can use as pass and login: usenet[/color]
>
> 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.[/color]

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...
[color=blue]
> Now, if you want to keep this popup approach, then update the main file
> and the popup file with the following patterns.
>[/color]
Thx for the code! But i will first to try to get everything on the main page
:)
[color=blue]
>
> HTH,
> Yep.[/color]

Greets Wouter


  #17  
Old July 24th, 2005, 07:55 PM
Wouter
Guest
 
Posts: n/a

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


[color=blue][color=green]
>> Now, if you want to keep this popup approach, then update the main file
>> and the popup file with the following patterns.
>>[/color]
> Thx for the code! But i will first to try to get everything on the main
> page :)
>[/color]

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


  #18  
Old July 24th, 2005, 08:05 PM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Wouter wrote:
[color=blue]
> 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.[/color]

This is a security feature, you can only close a window that you have
opened, not the main window.
[color=blue]
> So
> thats why i want to know i it polibele whit javascript to send a form whit a
> target in the same window.[/color]

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.
  #19  
Old July 24th, 2005, 08:05 PM
Yann-Erwan Perio
Guest
 
Posts: n/a

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


Yann-Erwan Perio wrote:
[color=blue]
> 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.[/color]

And of course remove the self.close() call, since you're working with
one window you don't want to close it.


Cheers,
Yep.
  #20  
Old July 24th, 2005, 08:45 PM
Wouter
Guest
 
Posts: n/a

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


[color=blue]
> 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.[/color]

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


Closed Thread