Skip to main content
Inspiring
September 24, 2008
질문

Using cfparam

  • September 24, 2008
  • 2 답변들
  • 387 조회
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
이 주제는 답변이 닫혔습니다.

2 답변

BKBK
Community Expert
Community Expert
September 29, 2008
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.

Inspiring
September 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.