Prevent Searching When Fields Are Empty

By: Peter S | Asked: 02/24/2023
ForumsCategory: How-toPrevent Searching When Fields Are Empty
Peter S asked 2 years ago

Hey, 

I have a two field search. Forename and Surname.

I don't want users to be able to search when both fields are blank, but I also don't want to have to use the "required field" options because then both fields need to be filled.

I want either or field to be filled for the search to work. 

Can anyone help?

Thanks!

1 Answers
Walter JonesWalter Jones answered 2 years ago
You could use conditional logic to hide the submit button.  Set the logic for each field to Show submit when the field is not equal to “leave the space blank”.  

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right