Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 30th, 2004, 02:32 AM
Authorized User
Join Date: Jan 2004
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Alternative to onBlur() event

I am using onblur() event in an ASP page to validate the data entered in a textbox. Data should not be aphanumeric. It should be only numeric. The code is working fine:

<td><input type="text" id=txtPSTelExtn name=txtPSTelExtn size = 4 maxlength = 4 onBlur="validateEntry(window.document.frmOfficer.t xtPSTelExtn)" value =<%=PSTelExtn%> ></td>

But i want to know if there is any alternative to using onblur event. I dont want to use it. I guess it gives problems sometimes.

Old April 30th, 2004, 11:28 AM
Friend of Wrox
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

You will probably get more answers in the HTML Code Clinic or JavaScript How-To forums, as this has almost nothing to do with ASP. You are only giving the textbox a value with ASP.

Besides, what kind of problems do you experience using onBlur?



Old April 30th, 2004, 02:09 PM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts


Your other option is to validate it when the form is submitted. You can use javascript at the form level to validate elements when the form is being submitted. Other than that, I know javascript has onblur and onfocus events for retrieve/lost focus.

Old April 30th, 2004, 09:07 PM
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

I dont think there is an alternate to this.

1) You can use write a Javascript function and validate it at client-side once the value is entered and focus is off from this conrol otherwise onclick of SUBMIT button validate all the FORM controls using an user-defined javascript function and return sussess/failure on validation and submit the form based on the reult returned.

2) You can submit the values from the form and validate it using ASP functions at the server-side.

AFAIK, there is no other possibility.

I would STRONGLY suggest doing both client-side and server-side validation as a good practice, as considering the cross-browser-compatibility, some functionalities may work in some browser and some may not. But you got to take pain in coding for both the types of validation for the better working of you app.

Hope that Helps.

-Vijay G

Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternative to BOOKMARKS Shiamak Word VBA 2 October 31st, 2008 04:04 PM
quick one: onblur - text box highlight retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 6th, 2008 05:18 PM
calling a codebehind function on onblur event vishnupriya.kamalakaram ASP.NET 1.0 and 1.1 Basics 2 July 7th, 2006 08:25 AM
How to call a codebehin function on onblur event?? kv Priya ASP.NET 1.0 and 1.1 Professional 1 June 14th, 2006 02:43 PM
tabindexes don't work with onBlur function in Net elisabeth Javascript 14 November 24th, 2004 11:07 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.