[flexcoders] Re: DateField - minYear and maxYear - don't work if they contain calculated valu

2009-09-04 Thread flexcoder2008
Thanks valdhor,

I tried your example and yes it works...very strange.  

I noticed another person had a similar issue to me at this post:
http://forums.adobe.com/message/1052372;

The thing is, I was working with 2 datefields trying to do some date math to 
ensure restricted values for a start and end date. After removing this date 
math and trying your example everything worked.

I think there is a built in bug with the datefield though.  The issue seems to 
be when you set the minYear and maxYear to the same value.  In this case the 
maxYear value works but the minYear doesn't.  Try it with your example, make 
both values {year} and you will see that you can keep navigating back before 
the minimum year.



--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 I am using SDK 3.3 and this works for me:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=vertical
  mx:Script
  ![CDATA[
  [Bindable] private var year:int = new Date().getFullYear();
  ]]
  /mx:Script
  mx:DateField maxYear={year} minYear={year - 9}/
 /mx:Application
 
 I can only select a date between Jan 2000 and Dec 2009.
 
 
 --- In flexcoders@yahoogroups.com, flexcoder2008 djohnson29@
 wrote:
 
  I have a DateField and if I set the minYear or the maxYear property to
 a value directly, everything works great.
 
  eg.
 
  mx:Datefield maxYear=2009 minYear=2000/
 
  But if I want to use a calculated value in there, it doesn't work.  I
 can navigate past this value.
 
  eg.
 
  [Bindable]
  var year:int = new Date().getFullYear();
 
 
 
  mx:DateField maxYear = {year} minYear={year - 10}/
 
 
  Why is this? Does anybody have a workaround for this?
 





[flexcoders] Re: DateField - minYear and maxYear - don't work if they contain calculated valu

2009-09-04 Thread valdhor
Yes, that does appear to be a bug.

A simple workaround is to use a selectableRange:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=vertical
 initialize=onInit()
 mx:Script
 ![CDATA[
 [Bindable] private var selectableRange:Object = new
Object();

 private function onInit():void
 {
 var currentDate:Date = new Date();
 selectableRange = {rangeStart:currentDate, rangeEnd:new
Date(currentDate.getFullYear(),11,31)};
 }
 ]]
 /mx:Script
 mx:DateField selectableRange={selectableRange}/
/mx:Application


--- In flexcoders@yahoogroups.com, flexcoder2008 djohnso...@...
wrote:

 Thanks valdhor,

 I tried your example and yes it works...very strange.

 I noticed another person had a similar issue to me at this post:
 http://forums.adobe.com/message/1052372;

 The thing is, I was working with 2 datefields trying to do some date
math to ensure restricted values for a start and end date. After
removing this date math and trying your example everything worked.

 I think there is a built in bug with the datefield though.  The issue
seems to be when you set the minYear and maxYear to the same value.  In
this case the maxYear value works but the minYear doesn't.  Try it with
your example, make both values {year} and you will see that you can keep
navigating back before the minimum year.



 --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote:
 
  I am using SDK 3.3 and this works for me:
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  layout=vertical
   mx:Script
   ![CDATA[
   [Bindable] private var year:int = new
Date().getFullYear();
   ]]
   /mx:Script
   mx:DateField maxYear={year} minYear={year - 9}/
  /mx:Application
 
  I can only select a date between Jan 2000 and Dec 2009.
 
 
  --- In flexcoders@yahoogroups.com, flexcoder2008 djohnson29@
  wrote:
  
   I have a DateField and if I set the minYear or the maxYear
property to
  a value directly, everything works great.
  
   eg.
  
   mx:Datefield maxYear=2009 minYear=2000/
  
   But if I want to use a calculated value in there, it doesn't work.
I
  can navigate past this value.
  
   eg.
  
   [Bindable]
   var year:int = new Date().getFullYear();
  
  
  
   mx:DateField maxYear = {year} minYear={year - 10}/
  
  
   Why is this? Does anybody have a workaround for this?