Forum Moderators: phranque

Message Too Old, No Replies

Auto load new window from form submit

form onsubmit open window

         

spleenboy

2:49 pm on Apr 10, 2003 (gmt 0)



I know how to open a new window from submittimg a form, but this does not seem to work if the process is automated. Check out this code :-
<html>
<head>

<script>
function furtherDetails(capId)
{
document.PBQQForm1.p_pro_id.value = capId;
document.PBQQForm1.submit();
}
</script>

</head>
<body>

<a onMouseOver="this.style.cursor='hand' "href="javascript&#58;;" onClick="javascript:furtherDetails(5);return false;">
Push me</a>

<form name="PBQQForm1" method="post" action="qq_add_dets_pack2.fe_template"
target="foo" onsubmit="window.open('', 'foo', 'width=600,height=700,status=no,resizable=yes,scrollbars=yes')">
<input name="p_pro_id" type="hidden">
<input type="submit">
</form>
</body>
</html>

If the submit button is pushed, it works. If the link is pushed it doesn't. Any ideas from you clever people?

le_gber

3:08 pm on Apr 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi spleenboy an Welcome to WebmasterWorld [webmasterworld.com]

both are working for me! (IE6 and Opera6)

Leo

[edited by: le_gber at 3:10 pm (utc) on April 10, 2003]

korkus2000

3:09 pm on Apr 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the board spleenboy,

Are you using IE6 to test. I have run into problems with the submit() method with IE6.

<added>Your right le_gber, working for me in IE6 also</added>

eaden

3:35 pm on Apr 10, 2003 (gmt 0)

10+ Year Member



didn't work for me in IE6

I came across this :

[experts-exchange.com...]

which summs up as :

the onsubmit function is not automatically activated when the submit() function is called.

le_gber

5:02 pm on Apr 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What about using onsubmit="return function()"

maybe this'll work.

I use it to check a form before submitting it, if return false form not submitted and alert box displayed if return true form submitted

leo

vauneen

9:28 am on Apr 17, 2003 (gmt 0)



i got around this issue by using this function OnClick of the submit button (the submit button is not really a submit button, it's type is 'button' but it says 'submit'):

heres the form tag:
<form name="frmstuur" method=post action="submit.asp" target="foo">

heres the function:
function DoSubmit(){
window.open '', 'foo', 'width=600,height=400');
document.frmstuur.submit();
}

vauneen.