0
I have two text type fields, where one is zip code and the other is Address.
/in the ZIP code field I use the ZIP code API, when I type in a ZIP code it completes the other fields with the results. I need a following validation:
- Perform a validation in 2 fields
- IF ZIP FIELD IS EMPTY,
- ADDRESS MUST BE MANDATORY IF NOT,
- ZIP CODE IS MANDATORY
Follow a small image of my form
Could someone help me?
How do you fill in the information, or at the end through a button? Or both?
– Don't Panic
@Everson has a button that does the validation at the end of the form
– Leonardo Macedo
@Renan already tried and I could not do the validation
– Leonardo Macedo
Required always requires to be filled in, so it cannot be used for the same validation.
– Don't Panic
@Everson yes, only if one is white the other will be required vice versa
– Leonardo Macedo
For the sake of logic: https://jsfiddle.net/pf1b7moa/
– Don't Panic
@Everson that’s right, it worked!
– Leonardo Macedo
@Leonardomacedo my answer served ? because you modified it.
– Mateus Veloso