Re: [PHP] Trap CR or "Enter" possible?

2002-03-23 Thread Miguel Cruz

On Fri, 22 Mar 2002, Erik Price wrote:
> I have noticed that pressing enter in IE does achieve the same effect as 
> pressing the "submit" button for my forms.  But I have also heard that 
> it's not really "the same", especially if there are more than one 
> "submit"-style inputs for the given form.  What does Enter "really" do 
> in IE?

To be safe, I usually include a hidden variable with a unique name in the 
form (). That way, no 
matter what browsers do about the Enter key, I still know what's going on.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Trap CR or "Enter" possible?

2002-03-22 Thread Don Read


On 22-Mar-2002 Erik Price wrote:
> 
> On Friday, March 22, 2002, at 12:29  PM, Jason Wong wrote:
> 
>>> Side note to the original poster: in the script that is the target of
>>> the form you are writing, you may be able to test for the presence of
>>> the "submit" variable -- if this value is not present, then the user 
>>> has
>>> not clicked the Submit button.  I know that the "value" of a submit
>>> input is usually just used to label the button in some way (such as
>>> value="Click Here for Free Porn!"), but you can actually test for this
>>> value if you have given the Submit input a name.  I may be wrong about
>>> this, though.
>>
>> Thus if you relied upon testing for the value of the submit button to
>> determine whether the form had been submitted (as opposed to being 
>> viewed for
>> the first time) then you're going to get unexpected results.
> 
> Right, but I was trying to come up with a way for the original poster to 
> test to see if the user had simply hit "enter" or if they had actually 
> hit the "submit" button (not as a test to see if the form was being 
> viewed for the first time).  IIRC he was having problems determining 
> whether or not the user had hit "enter" or hit the submit button.
> 

If you use an image for your submit button, then you can test for
$submit_x and $submit_y.

-- 
Don Read   [EMAIL PROTECTED]
-- It is necessary for me to learn from others' mistakes. I 
   will not live long enough to make them all by myself.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Trap CR or "Enter" possible?

2002-03-22 Thread Erik Price


On Friday, March 22, 2002, at 12:29  PM, Jason Wong wrote:

>> Side note to the original poster: in the script that is the target of
>> the form you are writing, you may be able to test for the presence of
>> the "submit" variable -- if this value is not present, then the user 
>> has
>> not clicked the Submit button.  I know that the "value" of a submit
>> input is usually just used to label the button in some way (such as
>> value="Click Here for Free Porn!"), but you can actually test for this
>> value if you have given the Submit input a name.  I may be wrong about
>> this, though.
>
> Thus if you relied upon testing for the value of the submit button to
> determine whether the form had been submitted (as opposed to being 
> viewed for
> the first time) then you're going to get unexpected results.

Right, but I was trying to come up with a way for the original poster to 
test to see if the user had simply hit "enter" or if they had actually 
hit the "submit" button (not as a test to see if the form was being 
viewed for the first time).  IIRC he was having problems determining 
whether or not the user had hit "enter" or hit the submit button.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Trap CR or "Enter" possible?

2002-03-22 Thread Erik Price


On Friday, March 22, 2002, at 12:11  AM, Jason Wong wrote:

> But, what are the undesirable effects of just pressing enter? I know 
> that in
> IE pressing enter to submit a form is not the same as clicking on the 
> submit
> button. If that is what you are referring to then it's very easy to code
> around that and thus would not require javascript.

I have noticed that pressing enter in IE does achieve the same effect as 
pressing the "submit" button for my forms.  But I have also heard that 
it's not really "the same", especially if there are more than one 
"submit"-style inputs for the given form.  What does Enter "really" do 
in IE?

Side note to the original poster: in the script that is the target of 
the form you are writing, you may be able to test for the presence of 
the "submit" variable -- if this value is not present, then the user has 
not clicked the Submit button.  I know that the "value" of a submit 
input is usually just used to label the button in some way (such as 
value="Click Here for Free Porn!"), but you can actually test for this 
value if you have given the Submit input a name.  I may be wrong about 
this, though.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Trap CR or "Enter" possible?

2002-03-21 Thread Jason Wong

On Friday 22 March 2002 10:52, Andre Dubuc wrote:
> Thanks Martin,
>
> I forgot to mention: I would like to accomplish this using PHP since I'm
> not using Javascript. Will this still work with straight html?

You can't have your cake and eat it :)

What you require can only be done client-side which means the only sensible 
solution is javascript.

But, what are the undesirable effects of just pressing enter? I know that in 
IE pressing enter to submit a form is not the same as clicking on the submit 
button. If that is what you are referring to then it's very easy to code 
around that and thus would not require javascript.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Yow!  Maybe I should have asked for my Neutron Bomb in PAISLEY --
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Trap CR or "Enter" possible?

2002-03-21 Thread Andre Dubuc

Thanks Martin,

I forgot to mention: I would like to accomplish this using PHP since I'm not 
using Javascript. Will this still work with straight html?

regards,
Andre


On Thursday 21 March 2002 21:39, you wrote:
> do it in html/javascript like this:
>
> http://www.somewhere.com/"; method="get" onSubmit="return
> (this.okay.value != 'no');">
>   
>   
>   
> 
>
> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 22, 2002 1:39 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Trap CR or "Enter" possible?
>
>
> In one of my php pages, I have a form that requires the user to click
> "Search
> for Surname". If however they press "Enter", undesirable effects occur.
>
> I've successfully trapped if an empty string is in the  type="text">, but "Enter" eludes my efforts to trap it for an
> appropriate
> "Educational" message about following instructions :>
>
> ie:
>
> if ($sname == "") {echo "Please enter a Surname and click "Search for
> Surname'.", exit;}
> if (eregi(\r == true) {exit;}  // something tells me this isn't correct!!
>
>
> Any ideas how I can accomplish this -- the code is asking for search
> criteria
> for a query into PostgreSQL (it's coded between )
>
> Any ideas, suggestions, or where to look would be appreciated.
>
> Tia,
> Andre
>
>
> --
>
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
>
> May God bless you abundantly in His love!
>
> For a free Cenacle Scriptural Rosary Booklet --
> http://www.webhart.net/csrb/

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the suffering souls in Purgatory.

May God bless you abundantly in His love!

For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Trap CR or "Enter" possible?

2002-03-21 Thread Martin Towell

do it in html/javascript like this:

http://www.somewhere.com/"; method="get" onSubmit="return
(this.okay.value != 'no');">
  
  
  


-Original Message-
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 1:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Trap CR or "Enter" possible?


In one of my php pages, I have a form that requires the user to click
"Search 
for Surname". If however they press "Enter", undesirable effects occur.

I've successfully trapped if an empty string is in the , but "Enter" eludes my efforts to trap it for an
appropriate 
"Educational" message about following instructions :>

ie:

if ($sname == "") {echo "Please enter a Surname and click "Search for   
Surname'.", exit;}
if (eregi(\r == true) {exit;}  // something tells me this isn't correct!!


Any ideas how I can accomplish this -- the code is asking for search
criteria 
for a query into PostgreSQL (it's coded between )

Any ideas, suggestions, or where to look would be appreciated.

Tia,
Andre


--

Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the suffering souls in Purgatory.

May God bless you abundantly in His love!

For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Trap CR or "Enter" possible?

2002-03-21 Thread Andre Dubuc

In one of my php pages, I have a form that requires the user to click "Search 
for Surname". If however they press "Enter", undesirable effects occur.

I've successfully trapped if an empty string is in the , but "Enter" eludes my efforts to trap it for an appropriate 
"Educational" message about following instructions :>

ie:

if ($sname == "") {echo "Please enter a Surname and click "Search for   
Surname'.", exit;}
if (eregi(\r == true) {exit;}  // something tells me this isn't correct!!


Any ideas how I can accomplish this -- the code is asking for search criteria 
for a query into PostgreSQL (it's coded between )

Any ideas, suggestions, or where to look would be appreciated.

Tia,
Andre


--

Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the suffering souls in Purgatory.

May God bless you abundantly in His love!

For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php