cancel
Showing results for 
Search instead for 
Did you mean: 

Validation flag on Event handlers (Actions)

Former Member
0 Kudos

Hi,

if I'm not mistaken the validation flag in the Actions tab of a View has the function of preventing the execution of an Event handler method (Action) if there are validation errors.

Is it true?

If it is true, does it work only with the automatic validation done with the type description as found in the dictionary (es. an integer InputField cannot contain characters) or does it work also with custom generated validation errors?

Let me explain:

I have a number of fields in a form that are linked to string attributes. Legitimate values for those fields of course are a subset of the set of possible strings of given length. In those InputFields I've put in the OnEnter or OnChange event handler some logic to validate the inputs and, if the check fails, raise a validation error linked to the attribute via msgManager.reportContextAttributeMessage(...).

For example, let's say that I have an InputField where the user writes the VAT number. When the user presses Enter or the focus on the InputField is lost, a method is called to perform a sanity check on the VAT number to see if it is valid. If it's not, then a Context Attribute Message is shown to the user.

Let's say that I have a button "Create invoice". What I'd like to have is that the "Create invoice" event handler does not execute if there is a problem on the VAT number, without having to duplicate or redo the checks. I could move the checks only in the method of the button Event handler but in that case the user gets all the errors at the end.

Is this possible?

Thank you,

Pietro

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Pietro, in this case for validation it is better to use calculated attributes. here is an example