Hello Flexcoders,

 

I’m working on a simple login form and attempting to accomplish the following:

 

+ Assign a default button to login so after page loads and you hit enter the form submits, no need to click in to the page.

+ Assign selection to the first of the two text fields that have no text, otherwise focus should be on the button.

 

I have made a few attempts but I have not been able to get it all working, only some of the functionality here and there. 

 

Thanks for any help,

Allen

www.prismix.com/

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"

    initialize="checkLoginFormForSelection();">

    <mx:Script><![CDATA[        

        private function checkLoginFormForSelection() : Void

        {

 

            if (email.text.length == 0) {

           

                email.setFocus(email);

                Selection.setSelection(1,1)

                return;

           

            }

           

            if (password.text.length == 0) {

               

                password.setFocus(password);

                Selection.setSelection(1,1)

                return;

               

            }

       

        }

     ]]></mx:Script>

    <mx:Panel title="Login Form Focus" defaultButton="login">

        <mx:Form>

            <mx:FormItem label="Email">

                <mx:TextInput id="email" text="[EMAIL PROTECTED]"/>

            </mx:FormItem>

            <mx:FormItem label="Password">

                <mx:TextInput id="password" text=""/>

            </mx:FormItem>

        </mx:Form>

        <mx:Button click="mx.controls.Alert.show('You just logged in');" label="Login" id="login"/>

    </mx:Panel>

</mx:Application>

 

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS





--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.269 / Virus Database: 267.9.5 - Release Date: 25/07/2005

Reply via email to