Sebagian Tidak Bisa Diaksesshare-external
Is there any way to override TextInput error message/custom message for field validations?
1

There seems to be a basic validation for TextInput component if input-type is specified as any of ['number','email','passcode', 'phone']. In this case the error message we are getting in form component is Enter a valid number. Is there any way yo override/customise this error message to some meaningful message.

Ex. For a number input field with label ZIP code, Enter a valid ZIP code has more meaning instead of showing error message as Enter a valid number

Sai
Ditanyakan sekitar 5 bulan yang lalu
Jawaban yang Dipilih
1

It's not possible to modify the built-in error messages. Since WhatsApp dictates the built-in validation that is done for these components, they also control the error messages, to ensure they match the validation that happens (i.e. a 'enter a valid ZIP code' error message doesn't make sense if the validation is really only checking for non-numerical characters in the string).

That being said, there is a way for you to achieve your goal, but it requires some additional setup:

You can add your own error messages to input components by leveraging the error-message property of the Form object, as described here

This will require you to add an Endpoint to your Flow so that you can do the data validation, and dynamically add your error message. Couple of resources to help if you want to go down this route: * Intro to data-exchanges * Step-by-step walk-through of how to setup an Endpoint

14 Juni pukul 11.29
Bar