Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-21510

Button does not fire when setting that button as the container's defaultButton through ActionScript

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK 3.3 (Release)
    • None
    • mx: Form View
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Browser: Internet Explorer 7.x
      Language Found: English

    Description

      Steps to reproduce:
      1. Pulled sample defaultButton code (bottom of screen) from http://livedocs.adobe.com/flex/3/html/help.html?content=containers_intro_3.html
      2. Modified code to:
      a. Not set the defaultButton in the form container tag
      b. Disable the login button by default
      c. Enable login button and set the form's defaultButton upon the user entering values in the userid/password fields.
      3. Modified Code from livedocs:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      public function submitLogin():void

      { text1.text="You just tried to log in."; }

      public function checkSubmit():void
      {
      if (username.length>0 && password.length>0)

      { mySubmitBtn.enabled = true; myForm.defaultButton = mySubmitBtn; }

      }
      ]]
      >
      </mx:Script>

      <mx:Panel title="Default Button Example">

      <mx:Form id="myForm">
      <mx:FormItem label="Username:">
      <mx:TextInput id="username" width="100"
      change="checkSubmit()"/>
      </mx:FormItem>
      <mx:FormItem label="Password:">
      <mx:TextInput id="password" width="100" displayAsPassword="true"
      change="checkSubmit()"/>
      </mx:FormItem>
      <mx:FormItem>
      <mx:Button id="mySubmitBtn" label="Login" click="submitLogin();" enabled="false"/>
      </mx:FormItem>
      </mx:Form>
      <mx:Text id="text1" width="150"/>
      </mx:Panel>
      </mx:Application>

      Actual Results:
      After the user enters a userid, tabs, enters a password, and presses enter - nothing happens. The Login button is enabled, but pressing enter does not fire the form's defaultButton. Only after tabbing from one textinput to another does the button gain the defaultButton border and the enter key starts to work.

      Expected Results:
      After the user enters a userid, tabs, enters a password, and presses enter - the Login button fires and a message is shown saying 'You just tried to log in'

      Workaround (if any):
      None found. No solutions were found when posting this issue to the Adobe Flex Forums.

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: