Email and Telephone Validation: Making the Validation Work

Both options require changes to the model driven form, this is done at https://make.powerapps.com.

Custom Control Method

The optimal way of configuring the validation solution is to use the custom control called “Data8 Validation Indicator” provided in the solution.  The custom control should be placed on the email or phone number field and the other fields bound in the settings of the control.

The options for the control are as follows:

Status Field: Required. This should be bound to the status field specified in the configuration page.

Date Field: Required. This should be bound to the date field specified in the configuration page.

First Name Field: Optional – emails only. This should be bound to the first name field on the record.

Last Name Field: Optional – emails only. This should be bound to the first name field on the record.

Company Name Field: Optional – emails only. This should be bound to the first name field on the record.

Javascript Method

Select “Form Libraries” on the left-hand side and add the “data8_validation_base.js” library to your form.

Once this is added, add an event handler to the “On Load” event of your form called data8_validation_start, ensuring the execution context is passed as the first parameter.

Save and publish your form and it should immediately begin working. You can optionally add the target columns and last checked columns if you wish, although this is optional.

 

Setting the Error Level

The Javascript option allows some additional configuration. Within the configuration page of the “Data8 Validation Configuration” app you can specify behaviour experienced when an invalid piece of data is input. By both telephone and email, you will see a dropdown box:

Error:

Error will prevent the saving of the form and give an alert next to the invalid field, as well as on the top of the form on save.

Warning:

Warning will give an alert at the top of the page of any invalid data. This will not prevent the user saving.

None:

There will be no prompt on the screen, however the fields that store the valid status will still be automatically updated.

Overriding on a Form by Form basis

The options above as for a global set up and each table using the validation will adhere to that configuration, however you can override this on forms during the event handler set up.

The overrides are always specified as “Telephone Override”, “Email Override”. If you only want to override one type, leave the other one blank so for example, the following image will leave Telephone as its global setting but override Email on this form to be “Warning” instead.

 

Join the Conversation

Receive the latest news, views and hot topics directly in your inbox! Sign up below

Follow us on social media