Results 1 to 6 of 6

Thread: How to enable/disable a DateField

  1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    3
    Vote Rating
    0
      0  

    Default How to enable/disable a DateField

    Hi,

    I need to enable/disable a DateField everytime a dropdownlist changes its value.
    I'm trying to call myDateField.disable() method, but it isn't working.
    I'm using version 3.2.1 and this method is listed in documentation (http://www.sencha.com/deploy/dev/doc...form.DateField).

    According to the error message in Firebug, the Method doesn't exists (myDateField.disable is not a function).

    As I'm new to ExtJS, can anyone help me with this?

    Thanks a lot.
    FFM

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,626
    Vote Rating
    56
      0  

    Default

    I'd guess that your var myDateField is not referencing what you hope it is referencing.

    But since we see no code, it's impossible to help further.
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638
    Vote Rating
    2
      0  

    Default

    Try setDisabled(<boolean value>)

  4. #4
    Ext User
    Join Date
    Jun 2010
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Animal,

    Sorry, you are right. I'm using ExtJS with ASP.NET.
    Every TextBox with attribute rel="calendar" will be transformed in a DateField control.
    For now, it's just a simple test page.

    Here is some code:
    ASPX file:
    Code:
    <asp:TextBox ID="txtCalendar" runat="server" rel="calendar"></asp:TextBox>
    JS file:
    Code:
    Ext.onReady(function(){  
        var textBoxes = Ext.DomQuery.select("input[rel=calendar]");  
        
        Ext.each(textBoxes, function(item, id, all){  
            var cl = new Ext.form.DateField({  
                format:      "d/m/Y",
                width:       95,
                applyTo:     item  
            });  
        });
    });
    Code:
    var myDateField = Ext.get("txtCalendar");
    myDateField.disable();
    CrazyEnigma
    I've tried also use myDateField = Ext.get("txtCalendar").dom and myDateField.setDisabled(true);.

    As i said, I'm new to ExtJS, so, I'm not sure if I've done everything the right way.

    Thank you again.
    FFM

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,626
    Vote Rating
    56
      0  

    Default

    It's absolutely fundamental that you learn the difference between Ext.get and Ext.getCmp
    Longtime Sencha geek. Outspoken advocate of pure Javascript Views. Posts my own opinions.

  6. #6
    Ext User
    Join Date
    Jun 2010
    Posts
    3
    Vote Rating
    0
      0  

    Default

    My mistake. I told you I was a newbie. heheh
    Now it's working fine! Thanks a lot!
    FFM

Similar Threads

  1. Checkbox enable/disable
    By Brad2009 in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 5 Jan 2009, 11:07 AM
  2. enable/disable
    By yade in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 9 Aug 2008, 2:09 AM
  3. Enable then disable a field
    By captainm1uk in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 26 Nov 2007, 2:12 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •