27.5.08

Flex : Valider un formulaire avec la touche Entrée

Pour ne pas apporter de l'eau au moulin des personnes pour qui Flash est 99% mauvais et que les formulaires HTML sont mieux, il est indispensable de pouvoir valider les formulaires avec la touche "Entrée".

Je n'avais pas encore trouvé de moyen simple, propre et rapide de faire cela en Flex (autrement que passer par l'écoute des événements clavier).
Grâce à John C. Bland II, j'ai découvert LA solution : l'attribut defaultButton de Form.

Il suffit de définir le defaultButton pour le Form et Flex s'occupe du reste !

Un petit peu de code vaut mieux qu'un long discours :

<mx:Form id="loginForm" defaultButton="{cbtSubmit}">
<mx:FormItem>
<mx:Label text="Email " />
<mx:TextInput id="ctiEmail" />
</mx:FormItem>
<mx:FormItem>
<mx:Label text="Password " />
<mx:TextInput id="ctiPassword" displayAsPassword="true" />
</mx:FormItem>
<mx:Button id="cbtSubmit" label="Valider" click="submitForm()" buttonMode="true"/>
</mx:Form>

Dans cet exemple l'appui sur la touche Entrée va déclencher l'exécution de la fonction submitForm.
Simple, non ?

18 commentaires:

Anonyme a dit…

gay picture personals On your blog, familiar in the ICQ link tossed. It turned out that nothing I liked. Tepr always read will Yeah, sure, that there still might say. Well done! Quite strange material you provide to us I can not understand what was happening, but my current 2 images loaded. (((A vasche liked! How delightful !!!!!!!!!!!!) Thank you! In quotations! class) I ponra) especially!

Anonyme a dit…

doogie style sex toys read with pleasure Well without untoward happens - even a schoolboy on holiday give job. - Charles Lamb Who is mulberry? All true, but how else? Most people are happy as much as they have decided to be happy. - A. Lincoln Many find useful for themselves super original cool Content is interesting, learned a lot. I recommend everyone to read.

Anonyme a dit…

adult handicapped tricycles п»їVery interesting! Not very often can not understand how to update your blog? Thank you great! Well of course tin ... Happiness - not a reward for virtue, but virtue itself, not because we enjoy the happiness that curb their passions, but rather enjoy the happiness makes us able to curb them. - Spinoza Really? amazing. Belief in success - is the driving force and sin not to use it for their own personal goals. You read this and think .... A salary of between 5% per day IMHO, the author is wrong

Anonyme a dit…

portland oregon adult swinging Cool share: but we have to work all pouvolnyali, and what to do now? The morning began with a wonderful article, thank you! Excellent post, after reading several articles on the subject realized that everything did not look on the other hand, a post once very interested. somewhere I have already seen this ... decided to help and sent out a post in the soc. bookmarks. hope to rise in popularity Cool In my opinion you stole this article and placed on another site. I had already seen.

Anonyme a dit…

i am a spanked adult Who is mulberry? All true, but how else? Accidentally saw. Not expect. Cool everything: the picture and information Your site in the opera is not the adjustment is shown, and everything is fine! спасибки you for your clever ideas! Your site in the opera is not the adjustment is shown, and everything is fine! спасибки you for your clever ideas! I NRA) is a good idea. cool You normally happy about us with the best phrases thanks, take!

Anonyme a dit…

impetigo in adults Belief in success - is the driving force and sin not to use it for their own personal goals. Most people are happy as much as they have decided to be happy. - A. Lincoln Thanks for the post, and this issue Yes, but it's not all ... I hope it will still Added to your bookmarks. Now will you read much more often! rasskau you also an interesting story .. cool Blog just super, I will recommend to friends!

Anonyme a dit…

sex stories blogspot Interesting Login or register, but you should add more articles Super! Everything is very clear and competently, and at the same time without philosophising and narcissism, and in accessible language. Rare case when a person is divided into topical and interesting infoy. Thanks to author! zabavno And you know what a holiday today? Yes, the internet - is vast, even if it is possible to find A huge Thank you to you! and more posts on this topic will be in the future? It is waiting! Accidentally saw. Not expect. Well of course tin ...

Anonyme a dit…

adult hydrocephalus Really? amazing. Few feelings .. but nice ... On your blog, familiar in the ICQ link tossed. It turned out that nothing I liked. Tepr always read will The morning began with a wonderful article, thank you! On your blog, familiar in the ICQ link tossed. It turned out that nothing I liked. Tepr always read will Thank you! In quotations! Wine and women bring to us Accidentally saw. Not expect.

Anonyme a dit…

suzanne shaw sex tape Thank you! In quotations! Belief in success - is the driving force and sin not to use it for their own personal goals. Blog just super, I will recommend to friends! Yes, but it's not all ... I hope it will still A great portal, but it's worth more to add information fabulous idea ... we would learn ... great. And you know what a holiday today? In my opinion you stole this article and placed on another site. I had already seen.

Anonyme a dit…

sex emoticons rasskau you also an interesting story .. Oh, thank you. Oh, thank you. Thanks to author a blog for the information provided. Well of course tin ... Super! Everything is very clear and competently, and at the same time without philosophising and narcissism, and in accessible language. Rare case when a person is divided into topical and interesting infoy. Thanks to author! Thank you, useful thing. zabavno

Anonyme a dit…

adult novelties wholesalers I thank you - for the warm welcome) Thanks to a huge, super article. Yes, the news went on inetu and distributed by starshnoy force How delightful !!!!!!!!!!!!) Exl how old dupe! Really? amazing. The morning began with a wonderful article, thank you! п»їVery interesting! Not very often can not understand how to update your blog?

Anonyme a dit…

mature bondage sex cool .. took almost all)) rasskau you also an interesting story .. cool .. took almost all)) The author, and you are out of town? And you know what a holiday today? The morning began with a wonderful article, thank you! Hmm ... well, it pamoymu have extreme ... Why have a blog such attendance is low ... the way to put things in your blog or deterioration, will help remove

Anonyme a dit…

tila tequila having sex cool .. took almost all)) Thank you! In quotations! Yes, the news went on inetu and distributed by starshnoy force Interestingly, and cognitive, and will have something on this subject? Added to your bookmarks. Now will you read much more often! Thanks for the post, and this issue Thanks to a huge, super article. I do not know how the rest, but I liked it.

Anonyme a dit…

disney gay days 2009 Thanks for the post, and this issue Most people are happy as much as they have decided to be happy. - A. Lincoln Blog super, everything would be different! class) I ponra) especially! I do not know how the rest, but I liked it. read with pleasure Very glad that there was a desire to take this position in quotations! moskvasoset i ne ebet!

Anonyme a dit…

absinthe sex And you know what a holiday today? Very glad that there was a desire to take this position in quotations! The site just super, I will recommend to friends! So engrossed that I missed a football You can still search in Google .. Smoothly write, young man, and I still can not go, sloppy somehow beyond the text from the pen I think this is correct with time. Thank you very much! I took a too-handy. Who is mulberry? All true, but how else?

Anonyme a dit…

tropical adult vacations I NRA) is a good idea. and how difficult it is to your own blog? Accidentally saw. Not expect. Thank you very much! I took a too-handy. STUDY theme! rasskau you also an interesting story .. How delightful !!!!!!!!!!!!) while I'm alive, I will remember your resource zanoshu in bukmarki ....

Anonyme a dit…

puffed wheat baptist churches in upper marlboro maryland smoking of lamb's bread goatshit kent lowe washington summer and smoke herione smoking transvestites barbecue smoking recipe hit bg kent clausen new york jets american cancer society smoking

Anonyme a dit…

mulata porn Hmm ... well, it pamoymu have extreme ... moskvasoset i ne ebet! п»їVery interesting! Not very often can not understand how to update your blog? Cool Quite strange material you provide to us Blog just super, I will recommend to friends! Why have a blog such attendance is low ... the way to put things in your blog or deterioration, will help remove Yeah, sure, that there still might say.