• Spring naar de hoofdnavigatie
  • Door naar de hoofd inhoud
  • Spring naar de voettekst

Taskform: De flexibele app voor uw bedrijfssoftware

|

023-2340999

|

info@taskform.nl

|

Knowledge Base

|

Remote Support

|

LOG IN

Logo Taskform

TaskForm

De flexibele mobiele app voor uw bedrijfssoftware

  • Home
  • Hoe werkt Taskform?
    • TaskForm Data Connector
    • TaskForm Appbuilder ā„¢
    • Taakbeheer
  • Voorbeelden
    • Werkbon app
    • Werkplekinspectie app
    • Urenregistratie app
  • Referenties
    • Proteus apps
    • Factuursturen apps
  • Prijzen
  • Blog
Gratis Proberen

Validating Answers (Custom Validation)

Taskform > Starten met TaskForm > Validating Answers (Custom Validation)
Welcome to our Knowledge Base

When it comes to validating user answers, you have the following standard options:

  • Required – forces the user to provide *something* as an answer
  • Date/Number Range – allows you to easily set lower & upper limits for date and number answers
  • Answer Format – found on Text field types only, this enforces basic formatting requirements on the answer value

However, imagine if your Form involved capturing a job code into a text field.

The user should always enter a known job code, but the truth is that they can put in any textual value.

We know that a valid job code looks like “JOB-XXXX” where the XXXXs are a number value.


Wouldn’t it be cool if we could validate their input to ensure the value at least contains the text “JOB-“?

This is when you should use the Custom Validation property.

Custom Validation is a general purpose property that lets you define a form formula to check whether an answer value is valid.

A true outcome means that the field is valid and the user can proceed.

False means that the field is not valid and the user needs to provide a valid answer.

Custom Validation gives you the freedom to define pretty much any logic to validate an answer value.

IMPORTANT NOTE: Custom validation only works when there is a value entered in the field.

To force the user to input a value, use the Required property together with Custom Validation.

Let’s go through the steps needed to provide some custom validation for the Job Code scenario described above.

Open up a new or existing Form in the Form Designer, and perform the following steps:

1. Add a text field to your Form, with Title of “Job Code” and Data Name of “jobCode”.

2. Find the Custom Validation property on this Job Code field.

It’s located at the bottom of the properties list, in the Advanced section.

3. Now we need to create a formula that will give a True or False result.

When the formula result is True, the field will be considered valid.

When the result is False, the field will be invalid.

Enter the following formula into the Custom Validation property:

string-length({{jobCode}}) = 8 and substr({{jobCode}}, 0, 4) = ‘JOB-‘

Woah that’s a complicated formula!

Lets break it down:

  • string-length({{jobCode}}) = 8

    First we want to ensure that the answer is exactly 8 characters long.
    Remember we expect job codes to be entered in the fixed format “JOB-XXXX” – this is a total of 8 characters long.

  • substr({{jobCode}}, 0, 4) = ‘JOB-‘

    Next we want to ensure that the job code provided starts with the prefix “JOB-“.
    So we use substr() to grab the first 4 characters of the answer and check if it does indeed match the required prefix.

  • We use the and logic operator to ensure that both the above conditions must be met in order to return a TRUE result.

To understand more about how to create a formula, see the Creating a Formula help page.

4. Find the Invalid Message property on the new field.

It’s located near the top of the Advanced section.

By default the app will show a generic “Job Code is invalid” message to the user if the Custom Validation property result is false.

Let’s rather show a more custom message.

So set the Invalid Message property to something like “You must provide a valid Job Code in the format JOB-XXXX”.

This way the user understands how they must fill out the Job Code field.

All done!

Save your Form and Test it on your device to see your Custom Validation in action šŸ™‚

Tags:
  • Form Recipes
GeĆÆnteresseerd om gratis te proberen?

Laat uw gegevens achter en probeer onze app 30 dagen gratis.

Footer

Blog

  • Taskform wordt zelfstandig bedrijf en verwelkomt nieuwe directeur
  • Parijs Release: Innovatieve en Diverse Functies
  • Kopenhagen Update: Focus op Tijd Besparing
  • Berlijn update: Mobile app met OCR en Netsuite Koppeling
  • Roma update: Verbeter je apps

Support

Knowledge Base
Contact

Contact

info@taskform.nl
+31 023 2340 999

App store downloads

Download-Taskform-Android-app Download-Taskform-Apple-app