framework7io / framework7

Full featured HTML framework for building iOS & Android apps
http://framework7.io
MIT License
18.04k stars 3.23k forks source link

Input error management via JS #4134

Open sergeiavoroshilov opened 1 year ago

sergeiavoroshilov commented 1 year ago

Hello there!

I have a couple of ideas for implementing additional methods for inputs:

  1. add a method to reset the error state using a JS script;
  2. displaying custom error text using a JS script;

For example, we have an input field for a promo code, and if we apply an invalid code (checking on backend), we want to show an error to the user. Now we have to show a dialog. But it would be more clear for the user to highlight the field in red and add a red message at the bottom, as in a validation error.

sergeiavoroshilov commented 1 year ago

This this a feature request. I Don't know how to add label

shastox commented 1 year ago
  1. Reset: setCustomValidity('')
  2. Set error: setCustomValidity('error text');

And F7 method: validateInputs()