You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ha...@informatiefabriek.nl on 2003/05/19 17:34:49 UTC

target question

Hi all,

I'm sorry this is a bit off topic. But, I would not know where else to 
ask. And maybe you have encountered the same problem.

I have a form with 3 buttons. I use javascript to submit my form to 3 
different actions.
I would like to open a new window for one of the three buttons. Therefore 
I use the following code:

<html:submit value="Corrections" onclick="this.form.status.value='1'; 
this.form.action='/advertentieoverzicht/add_correction.do'; 
this.form.target='_blank'; this.form.submit();"/>

Now the problem. When I click that button IE opens 2 new windows instead 
of only one!
The problem does not exist in Mozilla, or Netscape. But, because 99% of 
all internet users use IE, I would like to get this to work in IE.

Any Ideas?

Thanks,

Harm de Laat
Informatiefabriek
The Netherlands



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: target question

Posted by Rick Reumann <r...@reumann.net>.
On Mon, 19 May 2003 15:58:23 -0400, Denis Avdic wrote:

> He is using three buttons to do three different things and only one of 
> them should open a new window.  A target in the form tag would actually 
> work for all three buttons, and that is not desirable here. 
> 
> Or am I completely off?  : )
> 
>>><html:submit value="Corrections" onclick="this.form.status.value='1'; 
>>>this.form.action='/advertentieoverzicht/add_correction.do'; 
>>>this.form.target='_blank'; this.form.submit();"/>
>>>

Well, the above button is only going to submit one form. I still think
what's happening is IE is probably processing this.form.submit() and then
process the actual submit button, whereas the other browsers are probably
only doing 'one' submit (which one, I'm not sure - the default submit
behavior or the this.form.submit() behavior). 

Regardless of whether you put the target="_blank" in the <form> tag
portion or keep it in this submit button portion, I don't think you want
to use this.form.submit() inside of a submit button because that's what a
submit button does. If he just uses a regular button and not a submit
button then the above should work fine.

-- 
Rick



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: target question

Posted by Denis Avdic <de...@betterway.net>.
He is using three buttons to do three different things and only one of 
them should open a new window.  A target in the form tag would actually 
work for all three buttons, and that is not desirable here. 

Or am I completely off?  : )

Rick Reumann wrote:

>On Mon, 19 May 2003 17:34:49 +0200, har wrote:
>   
>  
>
>><html:submit value="Corrections" onclick="this.form.status.value='1'; 
>>this.form.action='/advertentieoverzicht/add_correction.do'; 
>>this.form.target='_blank'; this.form.submit();"/>
>>
>>Now the problem. When I click that button IE opens 2 new windows instead 
>>of only one!
>>    
>>
>
>I could be wrong, but aren't you actually submitting twice when you click
>on your submit button? The submit button by default will submit the form,
>but then you also have this.form.submit(). Maybe I'm way off though:) 
>
>I think it's clearer if you just add the target="_blank" to your form
>tag... <form action="" target="_blank" ... />
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: target question

Posted by Rick Reumann <r...@reumann.net>.
On Mon, 19 May 2003 17:34:49 +0200, har wrote:
   
> 
> <html:submit value="Corrections" onclick="this.form.status.value='1'; 
> this.form.action='/advertentieoverzicht/add_correction.do'; 
> this.form.target='_blank'; this.form.submit();"/>
> 
> Now the problem. When I click that button IE opens 2 new windows instead 
> of only one!

I could be wrong, but aren't you actually submitting twice when you click
on your submit button? The submit button by default will submit the form,
but then you also have this.form.submit(). Maybe I'm way off though:) 

I think it's clearer if you just add the target="_blank" to your form
tag... <form action="" target="_blank" ... />

-- 
Rick



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org