TIP: Validating a field

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

TIP: Validating a field

Postby IT2Be » Tue Nov 11, 2003 10:59 am

When you validate a field you might do that via the onDataChange event like I did. But imagine this with my previous email validation example in mind:

- you input an email address or a string of addresses.
- there is a mistake in the field and you get an error message
- the method forces you back into the field
- you now <tab> into the field or place your cursor in another field

RESULT
- nothing changed so you DON'T trigger the onDataChange event!

SOLUTION
- trigger the method via onFocusLost. This will ALWAYS validate the field. The simple method won't slow down noticeable...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Return to How To

Who is online

Users browsing this forum: No registered users and 1 guest