Closed rursache closed 5 years ago
Hi Radu!
You can use datasource methods to use your own regular expressions for typing and to check field when view did end editing.
func animatedFieldTypingMatches(_ animatedField: AnimatedField) -> String?
use it to send your custom regular expression to check if a character is allowed or not. For example “[A-Z0-9]”, with this you can only type uppercased letters and numbers
func animatedFieldValidationMatches(_ animatedField: AnimatedField) -> String?
use it to check field when did end editing with your own regular expression
Also you can use delegate methods to get AnimatedField text when user ends editing
func animatedFieldDidEndEditing(_ animatedField: AnimatedField)
you can check and enable continue button in this method if animatedField.text is correct
NOTE: In the future, I will add some kind of delegate method or parameter with the result of this check.
Thank you for using AnimatedField!
hey Alberto, thanks for the quick answer!
i am interested to do something like this, using default regex rules from your code
on login button action:
if usernameField.isValid && passwordField.isValid { continue }
i currently cant do that with delegates. isValid is some kind of function that validates that current field on demand
thanks!
Good idea! I will update AnimatedField with isValid parameter
;)
Hi Radu! I've updated and released new version 2.0.3 with isValid parameter and new delegate method: didShowAlertMessage. Example is also updated ;)
How can i check if a field contains valid data?
I have a continue button that should only be enabled if all fields are valid, how to check that?