[CLOSED] Remove TextField's Input Mask

  1. #1

    [CLOSED] Remove TextField's Input Mask

    Hi folks, i wonder whether it's possible to remove TextField's InputMask. I tried to accomplish it by doing the following (unfortunately with no success):

    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <script type="text/javascript">
            var ClearMask = function () {
                var plugIn = Ext.PluginManager.get('inputMask_' + App._txt.id);
    
                if (Ext.isArray(App._txt.plugins)) {
                    App._txt.plugins.pop(plugIn);
                }
                else {
                    App._txt.plugins = null;
                }
    
                Ext.PluginManager.unregister(plugIn);
    
                Ext.destroy(App._txt.inputMask);
                Ext.destroy(App._txt.plugins[0]);
                Ext.destroy(App._txt.plugins);
    
                delete App._txt.inputMask;
                delete App._txt.plugins[0];
                delete App._txt.plugins;
    
                App._txt.updateLayout();
                App._txt.doComponentLayout();
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Panel Margin="10" Header="false" runat="server">
            <Items>
                <ext:TextField ID="_txt" runat="server">
                    <Plugins>
                        <ext:InputMask runat="server" Mask="(999) 999-9999" AlwaysShow="true" />
                    </Plugins>
                </ext:TextField>
                <ext:Button Text="Clear Mask" runat="server">
                    <Listeners>
                        <Click Fn="ClearMask" />
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Panel>
    </body>
    </html>
    Last edited by Daniil; Apr 09, 2013 at 4:11 AM. Reason: [CLOSED]
  2. #2
    Hi Raphael,

    Currently, InputMask doesn't support detaching on the fly.

    The simplest way would be re-rendering the TextField without the plugin.

    To get the plugin detachable on the fly, you should detach everything that the plugin attaches to a field. See the InputMask's init function to see what I mean.
  3. #3
    Vladimir implemented disabling/enabling functionality.

    Example
    <ext:TextField runat="server">
        <Plugins>
            <ext:InputMask ID="Mask1" runat="server" Mask="(999) 999-9999" />
        </Plugins>
    </ext:TextField>
            
    <ext:Button runat="server" Text="Disable mask" Handler="#{Mask1}.disable();" />
    <ext:Button runat="server" Text="Enable mask" Handler="#{Mask1}.enable();" />

Similar Threads

  1. [CLOSED] Required field validation for mask input
    By MTSI in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 11, 2013, 6:51 PM
  2. Input mask by code behind
    By ermanni.info in forum 2.x Help
    Replies: 3
    Last Post: Jan 13, 2013, 2:40 PM
  3. input text mask with L literal char
    By Wirianto Widjaya in forum 1.x Help
    Replies: 4
    Last Post: Mar 30, 2012, 6:35 AM
  4. [CLOSED] Input Mask for textfield
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 20, 2010, 10:20 AM
  5. Replies: 10
    Last Post: Aug 31, 2008, 5:36 PM

Posting Permissions