A password field input validation is looking for odd characters such as “[”, “&”, “$”.
I place the escape character \ before the character and the formula works.
example:
@If(@Contains( txtNewPW; “[” );@Failure(“do failure stuff”);@Success);
I test it and it works beautifully.
I close the form. When I re-open it the escape character is gone and the formula no longer works. This is what it looks like. The \ is gone.
@If(@Contains(txtNewPW; “[” );@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=8&]”);@Success);
Does anyone have any idea why this is so? What is going on? and… What can I do to fix this?
Thanks
Subject: input validation losing escape character
I think the vanishing of your \ character is unrelated to the formula not working. [ is not a special character in macro language strings, so “[” means the same thing as “[”. In fact, if you leave your formula and then return to it without saving the form, I think you’ll find the \ has already vanished.
There doesn’t appear to be anything wrong with the formula you show in your message. How exactly does it fail? I’m really tired of people saying something “doesn’t work” and not explaining what it does that they don’t like, as if there were only one possible way a thing could fail.
There’s also a field UrlPath that this formula uses. I wonder how UrlPath gets its value.
Subject: RE: input validation losing escape character
My apologies. I found the problem.
My troubleshooting was way off due to some buggy behavior caused by multiple @IFs in a fields input validation. Also complicated by the fact that the form is tested for use over the web and not thru lotus notes.
I found out that multiple @IFs in the input validation does not work. Had to sting together a long @If that handled multiple error scenarios.
Here’s the final code:
@If(@Contains(txtNewPW;“temp”);@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=6&]”);(@Length(txtNewPW) < 6);@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=7&]”);
!@Matches(txtNewPW;“+{0-9a-zA-Z}”);@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=8&]”);
!@Contains(txtNewPW;gNums);@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=9&]”);
!@Contains(@LowerCase(txtNewPW);gAlphas);@Failure(“[” + UrlPath + “/frmChgPW?OpenForm&ER=11&]”);
@Success);
Here’s what it does:
- It looks for the characters “temp” in the typed-in password, I can’t let the user use "temp 'cause thats how I can tell that it is a temp password and needs to be changed.
2)Password has to be > 6 characters.
3)All characters must be either 0-9 or a-z, lowercase or uppercase. gNums is a field on the form that contains “1”:“2”, etc. gAlphas is another field on the form containing “a”:“b”:“c”, etc. This causes an error on any special characters such as %, $, , etc
4)Password must contain at least one one number and at least one alpha. More important is that it contain at least one number.
If it finds an error it refreshes the change password web-page while passing it an error number so that the correct error message is displayed.
Feel free to use this code.
Subject: RE: input validation losing escape character
If I were you I would code these validations in JavaScript so that you don’t have to submit the form to find out if it’s correct.
Subject: RE: input validation losing escape character
This article tells a lot about how to do that. The article is a bit dated – nowadays you can write your functions in the JS Header and put your “onsubmit” event into the corresponding Domino event. But the majority of the article is still useful in showing how to reference field values, how to abort the save, etc.
Subject: RE: input validation losing escape character
How? The input validation only allows me to enter a formula.
Pardon my lack of experience. If you can be more specific as to your recomendation, I would appreciate it.