Reply to Re: Global (page) kill enter key

Your name:

Reply:


Posted by Ed Jay on 12/19/05 09:18

Adrienne Boswell <arbpen2003@sbcglobal.net> wrote:

>Gazing into my crystal ball I observed Ed Jay <edMbj@aes-intl.com> writing
>in news:pv6bq159lmmdfighhsusqqf083gelrec6c@4ax.com:
>
>> My form consists of text boxes, radio buttons and checkboxes. I use the
>> following js to trap(kill) the enter key during text box entry to prevent
>> inadvertent form submission:
>>
>> var keys = document.all?true:false;
>> function keyHandler(e) {
>> var _ret=true;
>> var _char=keys?event.keyCode:e.which;
>> if(_char==13)
>> _ret=false;
>> return _ret;
>> }
>>
>> I call it from within textbox form elements as
>><input name="X" type="text" onkeypress="return keyHandler();">
>>
>> This works fine as long as the focus is on a text box. OTOH, if I've
>> clicked a radio button or checkbox and then press 'Return (keycode 13)'
>> the form is submitted.
>>
>> How do I globally protect against such inadvertency?
>>
>
>I hope you are not relying on javascript to do all the validation. Make
>sure you validate on the server as well.

Nope and yup. Just trying to circumvent the user from having to go back
and do the form because they inadvertently hit enter.

--
Ed Jay (remove M to respond by email)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация