Search code examples
wordpressgravityforms

Make Gravity Forms Hidden Field Required?


I have a Wordpress site that uses Gravity Forms, including hidden fields which are required for proper functionality. Is there a way to make hidden fields on forms built with gravity forms required?

I will be sending out an email with a URL linking to this form which auto-populates these hidden fields. However, I'd like to make these hidden fields required, or prevent the form being submitted if these hidden fields are not set, which may happen if a user navigates to the form manually instead of navigating to it via a generated URL.

I wish to avoid the perception that the form has been submitted when it has only been submitted with partial information.


Solution

  • The simplest, code-free solution would be to use conditional logic to only show the submit button if your hidden fields are not empty. Here's what the settings might look like:

    You can take this a step further and use the opposite conditional logic to show an HTML field with a custom message letting the user know why they can't submit the form.