I’m working on building a Zapier application using their web interface and running into an issue with conditional field validation.
I have two input fields that I need to set up:
- First field: “Tax Details” (text input)
- Second field: “Tax Category” (dropdown selection)
What I want to achieve is making the dropdown field mandatory only when the text input contains “0” or “0%” as its value. So if someone enters zero or zero percent in the first field, they must select something from the dropdown.
Has anyone implemented similar conditional logic in Zapier apps before? I’m looking for the best approach to handle this validation scenario. Any guidance would be really helpful!
I faced a similar challenge while working on a Zapier integration recently. Instead of relying on standard validation methods, I found success using the computed property of the fields. You can set the required property of the dropdown based on an evaluation of the text input. Specifically, create a function that checks if the tax details field contains either “0” or “0%” and returns true to make the dropdown mandatory. Make sure your validation logic is dynamic enough to respond to changes in the text input, so users see the correct requirement after they type. Also, consider issues with whitespace; users often input it as " 0 ". Be sure to trim the input before your comparison.
i’ve done something similar but used zapier’s inputFields with dependsOn instead. set the dropdown to depend on your tax details field, then add a condition to check the value. works well, though you’ll need to handle edge cases like “0.0” or “0.00%”.
Just went through this exact scenario a few months back. What worked for me was putting the validation logic directly in the performSubscribe function instead of trying to handle it through field configuration. You can intercept the input bundle and check the tax details value before processing. If it matches your zero conditions, throw a validation error when the dropdown’s empty. This gives you more control over the validation message and timing. One thing to watch out for - make sure you’re checking for variations like “0.0%” and handling case sensitivity if users might enter “0%” vs “0 %”. The validation runs server-side so it’s more reliable than client-side field dependencies.