Strange problem (or still asleep)
Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Strange problem (or still asleep)
Change your OR to AND :) Todd Ashworth -- Certified ColdFusion Developer Network Administrator Saber Corporation 314 Oakland Ave. Rock Hill, SC 29730 (803) 327-0137 [111] - Original Message - From: David Baskin [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 2:20 PM Subject: Strange problem (or still asleep) | Hello, i'm running the code below and i'm not getting the expected results. | i'm passing in a variable with the length of 5 so i would expect that the | errorString would not be appended, but in fact it is. The same thing happens | when i pass in a variable with the length of 9. I can't seem to figure out | why this is happening. Can anyone help? Sorry if this is way basic. | | david | | code: | | script | | }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ | errorString = ListAppend(errorString, Please enter a valid | zipcode (too long/short), |); | errorFlags = ListAppend(errorFlags, zp, |); | | /script | | | ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Strange problem (or still asleep)
Not sure but trim the variable to make sure it's not carrying the spaces. John -Original Message- From: David Baskin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 1:20 PM To: CF-Talk Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script . }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); . /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Strange problem (or still asleep)
Looks like an early morning thing :) OR will evaluate to TRUE if either of the two statements evaluate to true...looking at your else if then, the only time this will evaluate to FALSE, is if cleanZipcode is BOTH 9 AND 5 at the same timeand that'd be something :) Try an AND in there instead. HTH Brian - Original Message - From: David Baskin [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 1:20 PM Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Strange problem (or still asleep)
Your logic is incorrect. A number will ALWAYS be either NEQ 9 or NEQ 5. Use an AND operator rather than an OR operator. Kevin [EMAIL PROTECTED] 05/15/01 11:20AM Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script . }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); . /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Strange problem (or still asleep)
Logic Problem. if (LEN(cleanZipcide) NEQ 5) OR (Len(cleanZipcode) NEQ 9). cleanZipcode = 5F ORT cleanZipcode = 9T OR F cleanZipcode = 7TOR T This statement is always true. Try writing for the positive instead of the negative. Happy Day! Doug - Original Message - From: David Baskin [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, May 15, 2001 2:20 PM Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Strange problem (or still asleep)
No, you're not still asleep, just bitten by the boolean bug. Look at your statement: if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)) { report error } This says, if the length is not 5 or if the length is not 9, report the error. To get past this, the length of the variable would have to be 5 AND 9!! In short, change your OR to an AND to fix the problem. -Original Message- From: David Baskin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 11:20 AM To: CF-Talk Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script . }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); . /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Strange problem (or still asleep)
that OR should be an AND. something can't be BOTH 5 and 9 at the same time. chris olive, cio cresco technologies [EMAIL PROTECTED] http://www.crescotech.com -Original Message- From: David Baskin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 2:20 PM To: CF-Talk Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script . }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); . /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Strange problem (or still asleep)
it's the OR statement. (LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9) will ALWAYS evaluate to true because if the string is 5 characters long then (...NEQ 9) will be true and if the string is 9 characters long then (...NEQ 5) will be true. Bryan Love ACP Internet Application Developer [EMAIL PROTECTED] -Original Message- From: David Baskin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 11:20 AM To: CF-Talk Subject: Strange problem (or still asleep) Hello, i'm running the code below and i'm not getting the expected results. i'm passing in a variable with the length of 5 so i would expect that the errorString would not be appended, but in fact it is. The same thing happens when i pass in a variable with the length of 9. I can't seem to figure out why this is happening. Can anyone help? Sorry if this is way basic. david code: script . }else if((LEN(cleanZipcode) NEQ 5) OR (LEN(cleanZipcode) NEQ 9)){ errorString = ListAppend(errorString, Please enter a valid zipcode (too long/short), |); errorFlags = ListAppend(errorFlags, zp, |); . /script ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists