[CLOSED] Default button

  1. #1

    [CLOSED] Default button

    How can I achieve a default button behavior? For example, I have a triggerfield on my page for searching. When the cursor is in the textbox and user press enter, I want the page to postback and fire the TriggerClicked event. That's just one example. Same kind of behavior is desired for Listeners and AjaxEvents.
  2. #2

    RE: [CLOSED] Default button

    Any ideas?
  3. #3

    RE: [CLOSED] Default button

    This seems to work so in case anyone is wondering, here's how I solved it:

    TriggerField markup
    <ext:TriggerField runat="server" ID="txtSearch" EmptyText="Search..." AutoPostBack="true">
                                        <Triggers>
                                            <ext:FieldTrigger Icon="Clear" />
                                            <ext:FieldTrigger Icon="Search" />
                                        </Triggers>
                                        <Listeners>
                                            <SpecialKey Fn="searchKeyPressHandler" />
                                        </Listeners>
                                    </ext:TriggerField>
    External JS File
    var searchKeyPressHandler = function(f, e) {
        if (e.getKey() == e.ENTER) {
            this.onTriggerClick(e, this, {index: 1, t: this.getTrigger(1), preventDefault:true});
            e.stopEvent();
        }
    }
    Make sure to do e.stopEvent() to prevent a double postback. This should also work for AjaxEvents. Please let me know if there's a better way to handle this.

Similar Threads

  1. [CLOSED] Configure the Confirmīs default button
    By RCN in forum 2.x Premium Help
    Replies: 2
    Last Post: Jun 19, 2012, 1:51 PM
  2. Still unable to make login button as default button
    By santhu12smart in forum 1.x Help
    Replies: 3
    Last Post: Oct 05, 2011, 8:13 AM
  3. Panel Default Button
    By speddi in forum 1.x Help
    Replies: 8
    Last Post: May 23, 2010, 7:32 PM
  4. confirmation window default button
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Aug 13, 2009, 5:02 AM
  5. [CLOSED] Set form default button of a window
    By juanpablo.belli@huddle.com.ar in forum 1.x Premium Help
    Replies: 2
    Last Post: Mar 11, 2009, 8:08 AM

Posting Permissions