Connecting Tech Pros Worldwide Forums | Help | Site Map

Forcing the user to type

Shelly
Guest
 
Posts: n/a
#1: Dec 25 '05
I have not been able to find the answer to this on the net.

I want to force the user to type in text into a text field and not be
able to paste in text. This is for confirmation fields.

How can I do this?

Shelly
Happy holidays to all


Marian Heddesheimer
Guest
 
Posts: n/a
#2: Dec 25 '05

re: Forcing the user to type


On 25 Dec 2005 08:52:50 -0800, Shelly wrote:
[color=blue]
>I want to force the user to type in text into a text field and not be
>able to paste in text. This is for confirmation fields.[/color]

You should seek JavaScript tutorials how to capture and check
keystrokes from the user.
[color=blue]
>How can I do this?[/color]

not with PHP because PHP is a server side language that does not know
if the text was typed or pasted.

Marian

--
http://www.rent-a-tutor.com/wbt/
Online Courses for Everybody
Peter Fox
Guest
 
Posts: n/a
#3: Dec 25 '05

re: Forcing the user to type


Following on from Shelly's message. . .[color=blue]
>I have not been able to find the answer to this on the net.
>
>I want to force the user to type in text into a text field and not be
>able to paste in text. This is for confirmation fields.
>
>How can I do this?[/color]
Short answer - you can't.

But if you want an e-mail address confirmation
(a) you NEED to confirm another way - i.e. by sending an email to the
address with a secret in it to prove it is alive
(b) you could split the input into two eg
email [....] @ [.....]
confirm [....] @ [.....]
which means /some/ will need typing in again.






--
PETER FOX Not the same since the bra business went bust
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Janwillem Borleffs
Guest
 
Posts: n/a
#4: Dec 25 '05

re: Forcing the user to type


Shelly wrote:[color=blue]
> I want to force the user to type in text into a text field and not be
> able to paste in text. This is for confirmation fields.
>
> How can I do this?
>[/color]

Peter's solution would be my first choice, but if you really want to do
this, the only way is JavaScript, e.g.:

<input type="text" name="confirmemail" onpaste="return false" />


JW


Shelly
Guest
 
Posts: n/a
#5: Dec 26 '05

re: Forcing the user to type


I have done no Javascript. I am referencing the confirmemail control
in the submit code as
$_POST['confirmemail']. I need to keep that. Do I simply add
onpaste="return false" to the control? Where to I tell it Javascript,
and still process as php? The rest is all php.

Shelly
Guest
 
Posts: n/a
#6: Dec 26 '05

re: Forcing the user to type


I stuck that in to my control definition and it worked. Thanks.

Shelly
Guest
 
Posts: n/a
#7: Dec 26 '05

re: Forcing the user to type


I stuck that in to my control definition and it worked. Thanks.

Jerry Stuckle
Guest
 
Posts: n/a
#8: Dec 26 '05

re: Forcing the user to type


Shelly wrote:[color=blue]
> I stuck that in to my control definition and it worked. Thanks.
>[/color]

Try turning javascript off. You'll find it doesn't work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Keios
Guest
 
Posts: n/a
#9: Dec 26 '05

re: Forcing the user to type


I'm not meaning to be a scrooge the day after Christmas, but I think
the proper question to ask is "Should I" before "Could I". Why would
you want something like this?

Paxton
Guest
 
Posts: n/a
#10: Dec 26 '05

re: Forcing the user to type



Shelly wrote:[color=blue]
> I have not been able to find the answer to this on the net.
>
> I want to force the user to type in text into a text field and not be
> able to paste in text. This is for confirmation fields.
>
> How can I do this?
>
> Shelly
> Happy holidays to all[/color]

Please let me paste my passwords/email addresses into form fields. I
HATE having to re-type them.

/P.

Shelly
Guest
 
Posts: n/a
#11: Dec 26 '05

re: Forcing the user to type


That defeats the entire purpose of the confirmation field. If you are
able copy and paste, and the first one has an error, then you have
validated the error.

In the form that I am building, I want to force passwords to be retyped
and email addresses to be retyped. All the other fields can be copied
and pasted from anywhere else. These two fields are far too important
to allow an error to propagate by virtue of user laziness. BTW, I only
disallow the pasting in the confirmation box, so I would half-way
satisfy you.

Shelly

Keios
Guest
 
Posts: n/a
#12: Dec 26 '05

re: Forcing the user to type


Ah, my bad then. I thought you were using it so a user couldn't copy
and paste a confirmation code out of an email or some such silliness
like that. For those who are less fortunate and have only one monitor,
and let's say that their screen is only a 14" screen.

I know something like that would make me mad, as I've received
confirmation codes in emails that were something close to what seemed
several thousand letters long.

Anyway, that's all I was complaining about. I even type in my email
address and password, and I have the nifty browser plugins that
memorize the stuff for me!

So, happy holidays.

Chung Leong
Guest
 
Posts: n/a
#13: Dec 27 '05

re: Forcing the user to type


Jerry Stuckle wrote:[color=blue]
> Shelly wrote:[color=green]
> > I stuck that in to my control definition and it worked. Thanks.
> >[/color]
>
> Try turning javascript off. You'll find it doesn't work.[/color]

My solution to that is usually:

<noscript>

You must turn on Javascript.

</noscript>

Nicholas Sherlock
Guest
 
Posts: n/a
#14: Dec 27 '05

re: Forcing the user to type


Chung Leong wrote:[color=blue]
> Jerry Stuckle wrote:[color=green]
>> Shelly wrote:[color=darkred]
>>> I stuck that in to my control definition and it worked. Thanks.
>>>[/color]
>> Try turning javascript off. You'll find it doesn't work.[/color]
>
> My solution to that is usually:
>
> <noscript>
>
> You must turn on Javascript.
>
> </noscript>[/color]

Just to force the user to type in something instead of pasting it!? Why
not just let it slide if the user doesn't have Javascript.

Cheers,
Nicholas Sherlock
Jerry Stuckle
Guest
 
Posts: n/a
#15: Dec 27 '05

re: Forcing the user to type


Chung Leong wrote:[color=blue]
> Jerry Stuckle wrote:
>[color=green]
>>Shelly wrote:
>>[color=darkred]
>>>I stuck that in to my control definition and it worked. Thanks.
>>>[/color]
>>
>>Try turning javascript off. You'll find it doesn't work.[/color]
>
>
> My solution to that is usually:
>
> <noscript>
>
> You must turn on Javascript.
>
> </noscript>
>[/color]

And you've just lost at least one customer - me. I typically surf with
js turned off, and am not going to turn it on to fill in a form.

I know of several other people who feel the same way.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Peter Fox
Guest
 
Posts: n/a
#16: Dec 27 '05

re: Forcing the user to type


Following on from Jerry Stuckle's message. . .[color=blue]
>And you've just lost at least one customer - me. I typically surf with
>js turned off, and am not going to turn it on to fill in a form.
>
>I know of several other people who feel the same way.
>[/color]
I agree with you that the OP has lost the plot here. (See my earlier
post) Now making it worse by some demands to DO AS I SAY. Umm.

(1) The OP should
(a) validate email properly not by relying on a re-type and
(b) _supply_ a password.

(2) But hold on a minute Jerry, if you were thinking of trusting the
site to go to the lengths of clicking on a submit button when filling in
one of the OP's forms why would switching on JS be such a big deal? [1]
My reason for bringing this up is that there are some people who rely on
technical fixes to keep them safe rather than the Mk I brain.

[1] Perhaps not everybody has the NoScript extension for Firefox which
gives cool control over this sort of thing. Surely there's nobody out
there who still uses IE?


--
PETER FOX Not the same since the cardboard box company folded
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Jerry Stuckle
Guest
 
Posts: n/a
#17: Dec 28 '05

re: Forcing the user to type


Peter Fox wrote:[color=blue]
> Following on from Jerry Stuckle's message. . .
>[color=green]
>> And you've just lost at least one customer - me. I typically surf with
>> js turned off, and am not going to turn it on to fill in a form.
>>
>> I know of several other people who feel the same way.
>>[/color]
> I agree with you that the OP has lost the plot here. (See my earlier
> post) Now making it worse by some demands to DO AS I SAY. Umm.
>
> (1) The OP should
> (a) validate email properly not by relying on a re-type and
> (b) _supply_ a password.
>
> (2) But hold on a minute Jerry, if you were thinking of trusting the
> site to go to the lengths of clicking on a submit button when filling in
> one of the OP's forms why would switching on JS be such a big deal? [1]
> My reason for bringing this up is that there are some people who rely on
> technical fixes to keep them safe rather than the Mk I brain.
>
> [1] Perhaps not everybody has the NoScript extension for Firefox which
> gives cool control over this sort of thing. Surely there's nobody out
> there who still uses IE?
>
>[/color]

Peter,

It has nothing to do with trusting any particular site. I normally surf
with JS off. It's a hassle to have to constantly turn it on for one
page then turn it off again. So when I get to a site which requires
javascript, unless there's a very good reason why I should continue, I
just move on.

There are generally a lot of other sites which don't require javascript
but can fulfill my needs at the time.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Chung Leong
Guest
 
Posts: n/a
#18: Dec 28 '05

re: Forcing the user to type


Jerry Stuckle wrote:[color=blue]
> And you've just lost at least one customer - me. I typically surf with
> js turned off, and am not going to turn it on to fill in a form.
>
> I know of several other people who feel the same way.[/color]

Not everyone building a web site is a business, my friend. When it's
your government telling you you must have Javascript on, you don't have
much of a choice ;-)

Jerry Stuckle
Guest
 
Posts: n/a
#19: Dec 28 '05

re: Forcing the user to type


Chung Leong wrote:[color=blue]
> Jerry Stuckle wrote:
>[color=green]
>>And you've just lost at least one customer - me. I typically surf with
>>js turned off, and am not going to turn it on to fill in a form.
>>
>>I know of several other people who feel the same way.[/color]
>
>
> Not everyone building a web site is a business, my friend. When it's
> your government telling you you must have Javascript on, you don't have
> much of a choice ;-)
>[/color]

And not everyone who is visiting your site has javascript on.

You may be forced to have javascript on. Others are not. And my
government doesn't tell me I need to have javascript on.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Closed Thread


Similar PHP bytes