Re: [PHP]PHP script and new window.

2001-04-24 Thread Nikhil Goyal

Plutarck [EMAIL PROTECTED] wrote in message
9c2gdi$170$[EMAIL PROTECTED]">news:9c2gdi$170$[EMAIL PROTECTED]...
 First of all, I believe since you are using javascript on your button you
 shouldn't use type=submit. Change it to type=button, which means it
will
 have no effect for browsers that don't have javascript enabled when
clicked.
 That could be an error, for one. But then again, it might not.

I had a similar requirement - to run a javascript when a form is submitted.
the best way to do this was to remove the 'onClick' event from the submit
button and instead make an 'onSubmit' event on the form

but remember that onSubmit must return true is the form is to be submitted,
false if the form is NOT to be submitted. It must return.

 It might cause it to be submitted to one page and opened on another, which
 very well may be what you want to happen. However it might be that the

Another good way to do that is to add a TARGET=_blank option to the FORM
tag. Or you can add a TARGET=windowname option, where windowname is a
window which your onSubmit code opened. This will submit the code and
display results in a new window

N



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP]PHP script and new window.

2001-04-23 Thread Angerer, Chad

I have searched high and low for thos but with no luck.  Hopefully someone
will give me some good pointers.

I have a poll on a page that I am building which uses php.  I would like to
have a new window open when the submit and view results links are selected.
I am using an onClick and the view results window works fine.  It is the
submit button I am having trouble with.  The new window won't populate with
any info.  

Here is the form that I have on my page

form method=post action=vote.php
div class=pollTitle? echo $question; ?/div
div class=pollResponse
input type=Radio name=response value=1? echo $response1;
?br
input type=Radio name=response value=2? echo $response2;
?br
input type=Radio name=response value=3? echo $response3;
?br/div
input type=hidden name=id value=? echo $id; ?
font size=-2a href=# onClick=window.open('archive.php?id=?
echo $id;
?','archive','toolbar=no,status=no.location=no,menubar=no,top=50,left=50,he
ight=250,width=200,scrollbars=no'); return false;view
results/a/fontbrbr
input type=submit name=submit value=Vote
onClick=window.open('http://www.askedagain.com/vote.php','vote','toolbar=no
,status=no.location=no,menubar=no,top=50,left=50,height=250,width=200,scroll
bars=no'); return false;
/form

The vote script works fine as if I just have it load in the current browser
window.  Is there something that I am missing?  Any help and/or ideas are
much appreciated.

Thanks again.

CAA


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP]PHP script and new window.

2001-04-23 Thread Plutarck

First of all, I believe since you are using javascript on your button you
shouldn't use type=submit. Change it to type=button, which means it will
have no effect for browsers that don't have javascript enabled when clicked.
That could be an error, for one. But then again, it might not.

It might cause it to be submitted to one page and opened on another, which
very well may be what you want to happen. However it might be that the
window is being opened first then the data is submitted second, thus the
error that's being caused. To fix it just add the window.open function in
the head area of your document, so that as soon as the page is viewed the
window pops up. Annoying if the user hits refresh, but what you could do is
use a Meta-Refresh to take them from the page that pops up the window to the
page that user should be normally seing.

Next, how is it that you are getting the data and what data are you getting?
For instance, are you using the id you are submitting to the other page to
see how that user voted? Or are you just tracking who's viewing that page?

Further, does what you are displaying depend on what id is being submitted?

Lastly, view source on your HTML page and ensure all the fields are getting
filled out like you expect them to. It happens all the time that by using
View Source I find what my problem was.


--
Plutarck
Should be working on something...
...but forgot what it was.


Angerer, Chad [EMAIL PROTECTED] wrote in message
9E35C54B0C7AD411B5C1009027DE539940B5EF@MSPMX01">news:9E35C54B0C7AD411B5C1009027DE539940B5EF@MSPMX01...
 I have searched high and low for thos but with no luck.  Hopefully someone
 will give me some good pointers.

 I have a poll on a page that I am building which uses php.  I would like
to
 have a new window open when the submit and view results links are
selected.
 I am using an onClick and the view results window works fine.  It is the
 submit button I am having trouble with.  The new window won't populate
with
 any info.

 Here is the form that I have on my page

 form method=post action=vote.php
 div class=pollTitle? echo $question; ?/div
 div class=pollResponse
 input type=Radio name=response value=1? echo $response1;
 ?br
 input type=Radio name=response value=2? echo $response2;
 ?br
 input type=Radio name=response value=3? echo $response3;
 ?br/div
 input type=hidden name=id value=? echo $id; ?
 font size=-2a href=# onClick=window.open('archive.php?id=?
 echo $id;

?','archive','toolbar=no,status=no.location=no,menubar=no,top=50,left=50,he
 ight=250,width=200,scrollbars=no'); return false;view
 results/a/fontbrbr
 input type=submit name=submit value=Vote

onClick=window.open('http://www.askedagain.com/vote.php','vote','toolbar=no

,status=no.location=no,menubar=no,top=50,left=50,height=250,width=200,scroll
 bars=no'); return false;
 /form

 The vote script works fine as if I just have it load in the current
browser
 window.  Is there something that I am missing?  Any help and/or ideas are
 much appreciated.

 Thanks again.

 CAA


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]