Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using cfparam

Explorer ,
Sep 24, 2008 Sep 24, 2008
I have a parameter in a query string that should be a 4-digit year. I want to validate this to make sure it's numeric, and I was trying to use cfparam. If it's not numeric, I want to catch the error in a cfcatch tag, but it keeps skipping that tag & just displaying the error message anyway. Am I using the tag wrong?

Thanks
TOPICS
Getting started
358
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 24, 2008 Sep 24, 2008
The function you want is isNumeric. You have already checked for the existence or url.y with isDefined.

To find out what any cold fusion tag does, google "<cfNameOfTag> x", where x is the version number. x is also optional.

To find out what any cold fusion function does, google "coldfusion NameOfFunction x". x means the same as above.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 29, 2008 Sep 29, 2008
LATEST
Natg504,
There's nothing really wrong with your code. However, for the try-catch logic to work, you have to put the catch-block at the end. In fact, if your version is Coldfusion MX7or newer, you can even specify the range of years. Examples follow.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources