Mar
28

cfcalendar opens a 'new' world

8 comments Posted by: Laura

Today, Ben Forta posted an example to "Programatically change Flash Form calendar selectable ranges". At first sight, this is a nice example of using Actionscript to manipulate form controls. Reading the code a little more carefully, you can find a little gem: the word "new" is used to create a new date object. Those that tried creating new objects within ActionScript code have found that new, import, delete, createChild, loadmovie, duplicateMovieClip, AttachMovie, registerclass, createTextField, __proto__ cannot be used and writing any of those keywords would throw an "Illegal usage of ActionScript" error.

However, it seems that there are no restrictions imposed if we put a piece of code with illegal keywords in a cfcalendar. I do not know what this means, and why the cfcalendar tag does not have the same restrictions that the other tags have. If we use this now, can we be sure that the calendar will not be limited in the future to match the other tags?
I hope that the opposite happens instead. :)

Category: CFForm | ColdFusion |

8 Comments so far

Write yours
PaulH
cfform also has the same behavior. i'd bet this won't be "future proof".
pim
I found a way to create a date object from a string using the following code:

<cfgrid name="dg" onChange="var a = dg.selectedItem.date.split('/');cal.selectedDate=mx.formatters.DateFormatter.parseDateString(a[1]+'/'+a[0]+'/'+a[2]);">

The code is binding a datagrid column containing string dates to a calendar selectedDate.
pim
Btw, if you want to use any forbidden flash feature in CFForms, I just posted a trick where you can load a .swf file in a flash cfform and use it through a variable. This way you can add functions in the .swf that would be able to do anything you want, like importing classes, load movies etc ...

http://cfpim.blogspot.com

Cheers
pim
Hi Laura, Nahuel, sorry to post/repost but I think I have something intersesting for you regarding this thread, it might also be the subject of an 'onLoad event Part III' :D

http://cfpim.blogspot.com/2005/04/clock-timer-in-flash-cfform-opening.html

Thanks for the boost ;)
//P.
Fred Weber
5. Fred Weber wrote on May 27, 2005 at 9:53 AM
You can create new objects and arrays in cfform actionscript! There is a shortcut for creating both:

var myObject = {};
var myArray = [];

will create an object named myObject and an array named myArray.

This has worked for me to create a new event handler for my form.
Matt D
6. Matt D wrote on December 06, 2005 at 7:53 PM
I am attempting to bind cfcalendar to a cfgrid, so when you click on a date in the calendar it filters the grid.
First, I tried <cfcalendar name="FilterDate" ... onChange="var a = dg.selectedItem.date.split('/');cal.selectedDate=mx.formatters.DateFormatter.parseDateString(a[1]+'/'+a[0]+'/'+a[2]);">"> which didn't work.
I then tried to use the "ActionFilter() script from this site: <CFCalendar name="mycal"... onchange="applyFilter(mycal.selectedDate,mygrid,['StartDate'])"> which works, but only once ( if you click on a date, the filter has run and no records are shown in the grid)
Thanks in advance for your help!
BillCupps
Has anyone tried creating a cf custom tag that allows you to key in a date, or click on the image and get the datePicker? Doesn't seem that hard, but I've spent about 2 hours looking around for a custom tag to do this with no avail. Any ideas...
Jimmy
8. Jimmy wrote on May 19, 2006 at 9:41 AM
Matt D, were you able to find any information on the cfcalendar binding to the cfgrid? I need to do the same thing, but still no luck. IF you happen to find the solution, can you please post it.

Thanks,
Jimmy

Leave your comment

Comment etiquette: As a gesture to those subscribed to this post, please keep your comments relevant to the post.

Your email address will never be displayed.
Email is gravatar enabled.Gravatar are the pictures you see next to the comments. If you like to have one, visit gravatar



Allowed tags:

<code>
All other tags will be shown as such, when in doubt, use the preview.

Leave this field empty:


Preview:

Refresh Preview
1. You wrote on