Handle error after @failure

Hi,

is it possible to avoid the error message shown after @failure ?

I have for example the validation formula :

@If(CodePostal<100000;@Success;@Failure(

“Un code postal comporte au plus cinq chiffres”))

The message “Un code postal comporte au plus cinq chiffres” apppears and just after it, Lotus still send a generic error message to say that field’s format was wrong.

It is possible to avoid this generic error message ?

In addition, I’m still looking for an easy way to validate input without waiting the save action. Is there anyway to do that in Lotuscript or Formula ?

thanks

luc

Subject: handle error after @failure

Yes, it’s possible. You may use the lotuscript for field validations in query save event.

sample:

if uidoc.FieldGetText(“fieldname”) = “” then

messagebox “field is empty”

exit sub

end if

hope this helps…

Subject: RE: handle error after @failure

thanks for your answer Alberto

but in this way, how do you make the difference between an empty field and a field that is in error ?

For example my field “BP” is numeric but can be empty. So if user give non numeric caracters on it, the field will be empty but I won’t be abble to know if it is due to an error of format or not …

an idea ?

in addition, according to you, it is not possible to validate fields before “query save” process… correct ?

luc

Subject: RE: handle error after @failure

You can use the onBlur event of the field. For Notes client applications you can just refresh the document which will cause the field validation to execute before saving.

A fairly easy approach to this is to add a hidden button to the form where the code in the button consists of:

@Command([ViewRefreshFields])

The button needs to be assigned a name on the HTML attributes tab of the button properties.

Then add the following JavaScript function to the JSHeader of the form:

function refreshDocument() {

document.forms[0].RefreshDocButton.click();

}

The document can then be refreshed, for example in the onBlur or onChange event, by calling the JavaScript function. In your case, you could probably just add the call to the onBlur event as follows:

window.status = “DEBUG: The "onBlur" event is executing . . .”; // just so you can tell that the event executed

refreshDocument();

You could, of course, just write the validation purely in JavaScript, or even LotusScript, in the field events too.

hth,

dgg

Subject: RE: handle error after @failure

Dallas has addressed the use of javascript or lotusscript for doing field-level validation (something I deeply despise, but you asked for it). My question to you is What data type is your PostalCode field? If it’s text, then you should be using @If(@text(CodePostal)<100000…, and if it’s Number, then shouldn’t it be text so that you can store leading zeroes?

Subject: RE: handle error after @failure

Thank you both.

I put the refresh instruction in “Onchange” event of fields that I wanted to check.

By this way, the validation code is runned when the user gets out of the fields.

luc