Is there a method that can be given as a warning to validate the length of an input field?

  • 15 November 2022
  • 1 reply

Here I have used an info type field to validate the length of a contract id.

But, here I want to give a warning message as below.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 4
Badge +9

Hey @Aruna Dilshan 👋

I see you’ve written into our Support team with this question and I’ll share the solution here:

It wouldn’t be possible to customize the “Enter a valid value” text from your screenshot based on length of the input field for the user to see within the Zap Editor itself. For that purpose, including helpText for that inputField or alternatively an additional Copy type to let the user know about the 5 character limitation are the options.

You can however include field length validation in the perform for this action, so when the user tests that action or runs it live, an error would be returned. 

More information about the general error class is outlined here: 

You could use an IF statement to check whether the length of a specific field in the bundle.inputData (in this case bundle.inputData.contract_id) is greater than a specific length and return a general error class similar to the following:
throw new z.errors.Error('Contract ID must be less than 5 characters.')