Expand my Community achievements bar.

Setting and testing validation properties

Avatar

Level 2

There is a field property that tells me if it is valid or not valid.

How can I set and test this property?

Thanks, Laura

3 Replies

Avatar

Level 3

Hi Laura,

When you put a field (object) in a form, there are a number of "events" that you have access to. If you click the "Show" drop-down list in the top left corner of your screen, you will see a list of these events. One of the events is "validate." That's where you would write your code (FormCalc or JavaScript) to validate user input.

Hope that helps....

Avatar

Level 2

Hi Dave,

my problem is that: I need to set something like "isValid property" elaborating the results of a program that I call using a web-service. This program  validates the user input using data that are not in the form. Then, I need to validate the entire form testing both (the validate rules written in the validate event and the properties that I've setted using results of the web-service).

But I don't find this "property".

Thanks, Laura

Avatar

Former Community Member

To validate a field you would have to execute its validate event. That call will return a true or false value if it passes or fails validation. You can cause each individual obejct to validate by using the execValidate method or you use that method on a parent node then all children will be validated as well.

Hope that helps

Paul

BTW: John Brinkman - one of the fathers of XFA, has written a couple of great blogs on this topic you may want to check it out (it can get quite technical - but it is one of the best explanations that I have seen).

http://blogs.adobe.com/formfeed/validations/