Skip to Content

Some thoughts on validations for SAP Interactive Forms

I often get asked where validations for Interactive Forms should be implemented. There is the option to do it locally in the form using the possibilities provided by the Interactive Form (e.g. patterns or scripting) or it can be done on the back-end after the data is submitted back from the form. When you have to decide where to implement your validations you should also take a look at your scenario. If it’s an offline scenario you cannot do a server roundtrip for validations. Hence, validations have to be implemented twice: In the form and on the back-end. The recommendation here is to implement only validations that ensure data accuracy. More complex validations like verifying business partners should reside in the back-end. In other words do not put too much business logic into the form itself and error handling takes place on the back-end.

For offline scenarios a PDF has to contain everything you need for validations meaning the additional data (e.g. lists of allowed values) used for validating input is part of the PDF form and thus increasing it’s size. For online scenarios it’s easier since you can do a server roundtrip so you do not have to implement validations twice and include additional data. You only want to implement it on the back-end.


Interactive Forms allow defining two types of validations. The first one is a pattern-based data entry validation. The second possibility is to use one of the scripting languages (JavaScript or FormCalc) to implement a validation. While the first one only considers the actual field value, the latter can access other form fields via scripting.

Here is a description of building a small sample to play around with. In the sample we want to have a text field where either a code with either 3 or 6 alphabetic characters can be added. And it is not allowed to use the code “AAA”. Start Adobe Designer and create a new document. As next step drag a text field on the form. Go to the Object palette for the text field and select the tab “Field”. There “Limit length” has to be checked and the “max chars” are set to 6. As next step go to the “Value” tab. On this tab you can find a field/drop-down list for the validation pattern. Enter “text{AAA}|text{AAAAAA}” in the field. The vertical bar (|) is used to specify alternate patterns. In this case a pattern for a code with three characters and a second pattern for a code with six characters. “text” says that it is a text picture clause. For “Validation pattern message” enter something like “Pattern!”. And for “Validation script message” enter something like “Script!”. Now we have to implement the script for the check if the entered code is “AAA”. In the script editor select the “validate” event. Make sure the scripting language is JavaScript. For this event you can enter an expression that evaluates to true or false. Use the following expression: ‘this.rawValue != “AAA”‘. Save the form and do some tests in the PDF Preview.

For defining validation patterns it is necessary to know the pattern language. I strongly recommend taking a look at the Picture Clause Specification that is contained in Part 3 of the XFA specification. By the way if you have not seen my blog about “Useful documentation for developing Interactive Forms” I recommend looking at it 😉

In the picture clause specification you can find a pretty good description of patterns. Patterns are used in various ways for fields. You can define a display pattern, an edit pattern, a validation and a data pattern. A display pattern is used to format a data value when it is displayed on the screen. The edit pattern is used when a data value is edited. Validation patterns are used if a data value has to be validated after entry. And with the data pattern you can define in which format a data value is stored in the XML data.


You should add validations to your form wherever possible. Especially for offline scenarios additional “intelligence” greatly improves usability and acceptance. One thing that always should be done is to re-validate on the back-end to make sure no one manipulated the data.

You must be Logged on to comment or reply to a post.
  • Please keep posting new blogs. I would like to know what kind of security features are provided by Adobe on trigerring a data conection(web service). Is there a option of having a log-in pop-up(for thedata conection to the backend) other than digital signatures.

    Would like to see a blog on this.

    Kindly consider.
    – Anto.

    • Hi Anto,

      The security story behind Web Service calls is not the best. If you create a Web Service data connection in Designer there is no authentication at all. If you use the SOAP object and scripting you can at least have a user name/password authentication.


      • Does that mean that using web service calls in Adobe are not recommended, on security issues?

        Please suggest some alternatives.

        Thanks for your reply.
        – anto.

        • I wouldn’t recommend using Web Services on security issues.
          To suggest an alternative depends on your scenario (what you are using the Web Service for). For example if the Web Service is used to submit data I would suggest using an email to submit data. If your have an online scneario you could think about using Web Dynpro.


          • To submit data directly to SAP in an offline scenario.

            If the data is submitted through e-mail, do you mean by manual intervention (through an administrator for updation) or triggering an event in SAP(workflow).

            If latter is the case, how is the auhentication done?. The former is not favoured due to the manual intervention.

            Thanks for your prompt reply.
            Can’t i do some thing with digital signatures for this web service scenario. I believe this is possible.

            – anto.

          • What I’ve seen serveral times is an ABAP report monitoring an email address and then using the sender’s ID as authentication.
            Dig Sigs don’t help you in a Web Service scenario. They are part of the PDF form.


          • Thanks a lot. Thanks for the latest blog. I would like to see a blog on digital signatures 😉 …. 

            – anto.

  • Hi,

        If form based validation is performed, and if wrong data is entered, a Message Box appears showing the Validation Message, but after that the false value remains there in the field itself, its not cleared.
        It would be better, if it the field is automaticaly cleared after displaying the message.
        Is there a way to do this?


    • That the field is not cleared is standard behavior and I think the more common approach for example when you just need to change a few characters it would be no go idea to clear the file dall the time.

      What I could think of is implmenting you own validation in the validate event. Then you could clear the field.