[ic] Strip spaces from email

Eros Shop info at eros-shop.co.uk
Wed Apr 14 09:57:39 EDT 2004


At 14:33 14/04/2004, you wrote:
>Hi, I'd like to strip leading or trailing spaces from the email field, 
>which seems very straightforward, but I can't figure out where to put the 
>code.
>Hints?
>Thanks,
>Susan

Susan,

I would use an OnChange or OnBlur event on the email input field  to call a 
javascript function to do that job

eg:

<input name="email" type="text" size="30" onchange="my_javascript_function()">

or

<input name="email" type="text" size="30" onblur="my_javascript_function()">


I've put the 2 event definitions below incase one is more appropriate than 
the other :)

onchange
The onchange event is fired when the user commits changes to an <INPUT> 
element. The event does not fire when the actual changes are made, but when 
the user 'commits' them, by either submitting the form, or by 'blurring' 
(i.e. removing focus from) the element. Any code using the onchange event 
is executed before the onblur event (see above), if the change is commited 
by the user removing the focus.

onblur
When the referenced <INPUT> element loses the users focus, the onblur event 
is fired. On the fly form validation can make use of the onblur event to 
check form elements as the user is entering information.

I hope this helps

Mark



Eros Shop
vwe internet ltd
PO BOX 1067
SLOUGH
SL1 7YA
UK

Shop - http://www.eros-shop.co.uk
EMail - info at eros-shop.co.uk
Tel - 0870 737 3369
Fax - 0870 737 4469




More information about the interchange-users mailing list