Why doesn't this validation code work? if(event.value == 135.31 | event.value == '') event.value = '';
It works if I don't use 135.31 and I only use 125, but I don't want it to show this particular dollar amount. I don't know Java script at all, I copied most of this code from another forum. Any ideas? I can send the form I've created if that helps.
Blake Dodson
Thanks,
Why are you using the Bitwise OR and not the Logical OR?
The bitwise operators only process 32 bits of the the data string and not the entire floating point number.
I would also use the valueAsString property to test for the null string character, the value property sometimes treats the null character as a zero not a null string..
if(event.value == 135.31 || event.valueAsString == '') event.value = '';
Thank you. I don't know what Bitwise OR and Logical OR are. I copied this formula from another forum for $0.00 vaules so that they would not show. It worked for the $0.00 values, and it works for $125.00, but when I list a number with anything other than 00 after the decimal it doesn't work.
I copied and pasted your formula and it's still showing the $135.31 value in the feild.
Below is a snapshot of the form.
Thank you!!!!
That was my issue....I wasn't seeing the complete number since I had the field format set to show only 2 decimal places. I changed the format to show more places, changed the formula, and it works!
This the formula I've used: if (event.value == "135.3125") event.value = "";
Thank you both for your efforts!
North America
Europe, Middle East and Africa
Asia Pacific