PDA

View Full Version : How to enable/disable a DateField



felipefmelo
24 Jun 2010, 6:01 AM
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/docs/?class=Ext.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

Animal
24 Jun 2010, 7:04 AM
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.

CrazyEnigma
24 Jun 2010, 7:28 AM
Try setDisabled(<boolean value>)

felipefmelo
24 Jun 2010, 8:38 AM
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:


<asp:TextBox ID="txtCalendar" runat="server" rel="calendar"></asp:TextBox>


JS file:


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
});
});
});




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

Animal
24 Jun 2010, 9:31 AM
It's absolutely fundamental that you learn the difference between Ext.get and Ext.getCmp

felipefmelo
24 Jun 2010, 10:01 AM
My mistake. I told you I was a newbie. heheh
Now it's working fine! Thanks a lot!
FFM