Numeric field validation

Hi,

I put this formla in the “entry validation” tab of my field “siret”

@If(@IsNumber(siret);@Success;@Failure(“pb”))

It works fine, but I would like that this validation runs when the user is still in the field (“onchange”).

For now, my formula is checked when user try to save the doc, which is a little bit late.

Is there any property of the form to ask for field to checked when edit ?

Thanks for your help

Luc

Subject: numeric field validation

Input validation formulae do run when the document is saved; that’s how it was designed to work. If you want to test for things onChange, try javascript.

Subject: RE: numeric field validation

thanks for your answer Esther.

I am not an expert in Javascript… I would like to test if the fields are numeric, and for one of them, I would like to test if the length is 10 caracters.

By chance, would you have any samples of javascript codes that does this kind of test ?

Do Javascript codes run in Windows Client (like Lotuscript does) or just in Web client ?

sorry if I abuse…

thanks anyway

Luc

Subject: RE: numeric field validation

Yes, javascript runs in the Notes client in R6 and above. There are plenty of excellent javascript websites out there; I would suggest looking at a few.

In this case, to test to make sure a user has entered only numbers in a field, use isNaN(fieldName) in the onChange:

if (isNaN(document.forms[0].myField.value)) {

alert(“You must enter only numbers.”);

return false;

}

To test for length; use something like this:

var str=document.frmPwd.NewPassword.value;

str=str.toString();

str=str.toLowerCase();

if(str.length!=10) {

alert("This field must contain 10 digits.");

}

http://www.serve.com/hotsyte/index.cgi?http://www.serve.com/hotsyte/reserve.html

http://javascript.internet.com/