I think the problem is in the fact that for CF "no" and "false" are the same
thing (as well as "yes" and "true"). So you could try:

function convertBooleanOrNull(target) {
var value = "NULL";
switch (target) {
case "Y":
case true:
value = True;
break;
case "N":
case false:
value = False;
break;
}
return value;
}

  -----Original Message-----
  From: Patricia G. L. Hall [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 22, 2003 11:29 AM
  To: CF-Talk
  Subject: Switch:Case Differs in CFMX from CF5?

  I posted the other day about a way to have multipile values apply to the
  same case logic when writing a switch block in cfscript.  It went like
  this:

  switch(_expression_) {
       case "valuea":
       case "valueb":
            stuff;
            break;

      case "valuec":
           stuff;
           break;

      default:
           break;
  }

  I have run this syntax in CF5 successfully.  Just now I tried the same on
  a box with CFMX 6.1 and I get this error:

  Context validation error for tag CFCASE.
  The CFSWITCH has a duplicate CFCASE for value "1.0".

  So, the behavior has changed it seems to me.  Can anyone else validate
  this?  Also, is it a bug?  Or was it "fixed" because it shouldn't have
  been working the way it did in CF 5?

  FYI, here is the specifc code I was running:

  function convertBooleanOrNull(target) {
  var value = "NULL";
  switch (target) {
  case "Y":
  case "Yes":
  case true:
  value = True;
  break;
  case "N":
  case "No":
  case false:
  value = False;
  break;
  }
  return value;
  }


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to