cfdocs icon indicating copy to clipboard operation
cfdocs copied to clipboard

cfargument now accepts type=integer

Open pfreitag opened this issue 5 years ago • 12 comments

As of CF2016+ apparently https://trycf.com/gist/dcf63d355df1063831bd485ed0453d8e/acf2016

need to see what other types might be added and confirm when it was added.

pfreitag avatar Sep 11 '19 19:09 pfreitag

Looks like float can also be used as an argument type.

pfreitag avatar Sep 12 '19 15:09 pfreitag

And email

pfreitag avatar Sep 12 '19 15:09 pfreitag

telephone url ssn social_security_number also work.

Possibly all the cfparam types work except for regex which throws a java.lang.IllegalStateException (because it needs the pattern). I tried

<cfargument name="foo" type="regex" pattern="[0-9]{3}">

But still get a IllegalStateException.

pfreitag avatar Sep 12 '19 16:09 pfreitag

Interesting. Adding new types, especially undocumented, seems like it could break backward compatibility in some cases. I'm guessing these would take precedence over components of the same name, though I haven't tested that.

KamasamaK avatar Sep 12 '19 16:09 KamasamaK

Yeah, good point - I haven't tested that yet either, not sure which takes precedence.

Also want to add to the ticket that this only works for cfargument types, does not work for returntype.

pfreitag avatar Sep 12 '19 17:09 pfreitag

FYI - a ticket has been added to lucee: https://luceeserver.atlassian.net/browse/LDEV-2471

pfreitag avatar Sep 13 '19 16:09 pfreitag

Two years on, this feature is still not documented. Is it considered safe and supported for use in CF applications?

Is there any move on Adobe's part to expand support for integer types beyond this limited use? For example, in typed arrays?

mark-demoss avatar Dec 01 '21 16:12 mark-demoss

I see there's a ticket for Lucee, but I would recommend opening a ticket with Adobe to have these documented.

As for whether they add them to typed arrays, that should be another ticket.

KamasamaK avatar Dec 02 '21 20:12 KamasamaK

@KamasamaK I agree. Hey @mark-demoss can you create ticket(s) and post the link back here.

pfreitag avatar Dec 02 '21 21:12 pfreitag

Will do.

I also have an open support case and will let you know what I hear back.

mark-demoss avatar Dec 02 '21 22:12 mark-demoss

https://tracker.adobe.com/#/view/CF-4212587

mark-demoss avatar Dec 02 '21 22:12 mark-demoss

Adobe has updated their documentation:

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-a-b/cfargument.html

mark-demoss avatar Dec 07 '21 14:12 mark-demoss