[CLOSED] Set default listeners, properties for all textboxes in application

  1. #1

    [CLOSED] Set default listeners, properties for all textboxes in application

    I have an application requirement where all textfields must have property X set to 'Blah' and must have a listener on the change event to execute some 'Y' javascript. There can be multiple developers working on the same project, and I want to ensure that property and that listener are always set correctly. I thought of creating a custom class that inherits from Coolite's TextField and default the property and listener. That isn't ideal because someone may choose to still use Coolite's TextField instead of the custom one. Is there a way to do this in javascript by overriding the Ext TextField class? I been looking up Ext.override but that seems to override functionality of an existing method. Ext.Extend sounds promising but that creates a new class in javascript and I will have to create another new server class too.
  2. #2

    RE: [CLOSED] Set default listeners, properties for all textboxes in application

    In the past have you integrated this same "hard-coding" of functionality with the standard ASP.NET <asp:TextBox> control, or any other Control? If yes, I'm just wondering how that was accomplished.

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Set default listeners, properties for all textboxes in application

    We ended up creating a custom textbox that inherits from asp.net textbox. I was hoping ExtJS provides something that can do this in javascript. If not, I will just extend Ext.form.TextField and create the appropriate asp.net server control.
  4. #4

    RE: [CLOSED] Set default listeners, properties for all textboxes in application



    So why not just inherit from <ext:TextField> and override/add your properties? I guess anyway you look at it, preventing developers from using the <ext:TextField> instead of your custom inherited TextField control is really best controlled by policy. Or, the good old "search and replace", and a gentle "reminder" to the developer whom did not follow policy.

    Another option may be a Skins file, which could be setup to override all <ext:TextField>'s globally.
    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] Set default listeners, properties for all textboxes in application

    Thanks geoffrey. I will be extending the javascript Ext.TextField class and also create a new server class that inherits from Coolite's TextField. Reason I chose to extend the javascript class is just to reduce data sent to the client. I may have 10 textboxes on a form so I rather have the property set once in a cached javascript file rather than render the same javascript 10 times.
  6. #6

    RE: [CLOSED] Set default listeners, properties for all textboxes in application

    Reason I chose to extend the javascript class is just to reduce data sent to the client. I may have 10 textboxes on a form so I rather have the property set once in a cached javascript file rather than render the same javascript 10 times.
    That makes perfect sense and is a great approach.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Key events textboxes problem
    By mcfromero in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 14, 2012, 6:42 PM
  2. Replies: 0
    Last Post: Sep 27, 2011, 10:24 AM
  3. IDEA: Define default properties to prevent tag soup
    By reverseblade in forum Open Discussions
    Replies: 2
    Last Post: Aug 03, 2010, 7:56 PM
  4. [CLOSED] How evoit applying CSS properties to the whole application?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 17, 2010, 6:28 PM
  5. Replies: 7
    Last Post: Feb 13, 2009, 3:27 PM

Posting Permissions