12
May
07

Quicktip: Flex Form Validation - Sometimes tapping the user on the shoulder just isn’t enough

Since Flex 360 I’ve been completely engulfed in a large project in which a large portion of it is in yes, Flex. Flex and I have been getting along pretty well but from time to time we rumble a bit. In the case of form validation flex seems to be perfect in almost every way… except that after the validation happens the only signal to the user that something needs to be done is the hightlight around the control. This is the validation equivalent of a tap on the shoulder to the user.

What i wanted was to show was the rollover popup for the first form element the user had to alter in order to have a valid form immediately upon hitting submit. Unfortunately I couldn’t find any method to raise the popup so I wrote a quick little hack that does the job. Its not perfect, but one of the best things I learned from the flex 360 conference was when Jessie Warden said “sometimes you just throw stuff out there and its hot!”. Essentially, what I think he meant was what you do may not always be the best way, but if it does the trick… go with it.

private function setValidationFocus(formObject:Object):void{
formObject.setFocus();
formObject.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_OVER));
}

valpop.jpg
If anyone knows of a better way to accomplish this task, please send it my way.

thanks -s


1 Response to “Quicktip: Flex Form Validation - Sometimes tapping the user on the shoulder just isn’t enough”


  1. 1 Pingback on Jul 5th, 2007 at 2:27 pm

Leave a Reply




flickr