Skip to Content
Author's profile photo Ehud Nir

Input Validation

Here is a common example of input validation in an application:

4.PNG

In this example we want to make sure that:

  • At least one input is provided.
  • The dates range is at least 14 days

The Validation feature appears in the configuration properties for the control:

/wp-content/uploads/2013/10/5_310836.png

1. Open the validation dialog for the second date control, and define the invalid value. Use the DADD() functions to compute From Date + 14 Days, in this manner: =DADD(@from_date,14,”D”)

1.PNG

2. Run the application and test the results:

3.PNG

Specify the other condition, that at least one input should be provided. There are several options, we could make the error appear on the first control.

3. Define the following validation for the control:

  • Condition: User defined
  • Value: =ISNULL(@from_date)&&ISNULL(@to_date)&&ISNULL(@id)
    2.PNG

You could use the Dynamic Expression dialog to find the required functions / values:

/wp-content/uploads/2013/10/6_310837.png

4. Run the application:

4.PNG

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Good Article. Please let me know how to disable the Submit button disabled in the last screen after submission is done.

      Author's profile photo Ehud Nir
      Ehud Nir
      Blog Post Author

      Hi Soumya Chanda,

      This could be done this way:

      1. Add a Data Share element and a Boolean field:

      1.PNG

      2. Define the event name on the link to be "submit" (same event as the link to the Service).

      3. Define the data mapping as follows:

      2.PNG

      This way the value changes to false on submit.

      4. In the Layout Board define the Enabled condition:

      /wp-content/uploads/2014/05/3_459660.png

      Thanks,

      Udi

      Author's profile photo Former Member
      Former Member

      Hi Udi,

      Is it possible to create custom messages replacing the standard ones as in the attached screenshot.

      The field is mapped to a Numeric Data Type in function module. On providing " : "  as input it is throwing the error message. Is it possible to change this error message??

      ThanksNumberValidation.jpg

      Author's profile photo Ehud Nir
      Ehud Nir
      Blog Post Author

      Hi Soumya,

      Sorry for the late response. I don't know of such an option. One thing though: If you want to enter a "Time" value, you could have this control wired to a Time field. See in Define Data:

      The the UI control "expects" values like 10:33.

      Thanks,

      Udi

      Author's profile photo Former Member
      Former Member

      Thanks Udi. I do not need time value. The input field is for number of hours. In FM it is a numeric field.