Picnik-like Signup Form with Realtime Validation (AS2/AS3)
I'm looking to get some advice;
I'm about to build an OOP signup form in AS2 with realtime data validation. There are 3 fields 'Username', 'Password' and 'Email' and two of those will check with the server to see if the the username or email is taken. This is almost identical to the signup form on Picnik.com
The way I've experimented with so far is to begin an onEnterFrame event on the textField as it receives focus. This onEnterFrame function checks for spelling, character count etc
When the textField loses focus it then sends the data to the server and checks if it already exists. If it doesn't, it will validate.
What I've written works rather well (up until the submitting - haven't worked that out yet) but the code is rather unwieldy and seems too long.
MY QUESTIONS:
- 开发者_C百科
What is the best way to go about building this?
Are onEnterFrame checkers the best way to go?
Should the data send to the server onKillFocus?
Should the submit button trigger all the onEnterFrame validation functions to run again (in case the user didn't wait for validation)
Would you suggest building it a better way?
AS3 tips welcome - I'm only using AS2 for the moment as its for a client who requests it
Thanks!
onChanged in AS2 or Event.CHANGE in AS3 may be a better alternative than onEnterFrame for checking TextField input.
精彩评论