[CLOSED] [2.0] AutoFocus question

  1. #1

    [CLOSED] [2.0] AutoFocus question

    Hello,

    Just curious if there is a setting to automatically make the AutoFocus property focus to the end of a text field value instead of at the beginning? I do not want to enable the SelectOnFocus if possible.

    Cheers,
    Timothy
    Last edited by Daniil; Jun 25, 2012 at 1:31 PM. Reason: [CLOSED]
  2. #2
    Hi,

    There is no such built-in functionality.

    I have found this:
    http://stackoverflow.com/questions/5...-input-element

    The following appears to be working in IE and Chrome, but no in FireFox.

    Example
    <ext:TextField runat="server" Text="Hello!" AutoFocus="true">
        <Listeners>
            <Focus Handler="this.inputEl.dom.value = this.inputEl.dom.value;" />
        </Listeners>
    </ext:TextField>
    To get it working in FireFox I would try to apply the solution form the second answer using setSelectionRange.
  3. #3
    Thanks! I didn't realize it was a general HTML DOM issue; much appreciated for the suggestion. You can close this one -- as it's not your problem :)

    Cheers
  4. #4
    No problem, it was interesting to investigate since I have never met such requirement. It can be useful in my further practice.
  5. #5
    The following config might be helpful if you want to move the cursor index to the end of the TextField upon initial render.

    Example

    <ext:TextField ID="TextField1" runat="server" Text="Testing...">    <Listeners>
            <AfterRender Handler="this.selectText(this.getValue().length);" />
        </Listeners>
    </ext:TextField>
    Geoffrey McGill
    Founder
  6. #6
    Quote Originally Posted by geoffrey.mcgill View Post
    The following config might be helpful if you want to move the cursor index to the end of the TextField upon initial render.

    Example

    <ext:TextField ID="TextField1" runat="server" Text="Testing...">    <Listeners>
            <AfterRender Handler="this.selectText(this.getValue().length);" />
        </Listeners>
    </ext:TextField>
    Thanks that worked great.

    Cheers,
    Timothy

Similar Threads

  1. [CLOSED] Sorry~ one more question.
    By kkapjin in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 05, 2012, 11:16 AM
  2. [CLOSED] AutoFocus on ext.net X.Msg controls
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 25, 2011, 10:39 AM
  3. [CLOSED] [1.0] TableLayout question
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 06, 2010, 2:48 PM
  4. [CLOSED] [1.0] Question on
    By ljankowski in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 11, 2010, 7:49 AM
  5. [CLOSED] svn question
    By pkellner in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 24, 2008, 9:59 AM

Tags for this Thread

Posting Permissions