# Check if field hidden without looping through the form\['fields'\]? \[RESOLVED\]

**URL:** https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488
**Category:** Get Help
**Tags:** conditional-logic, gform\_validation, hidden, visible
**Created:** [August 17, 2019, 1:26pm UTC](https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488 "2019-08-17T13:26:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![djprog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/djprog/32/935_2.png) [@djprog](https://community.gravityforms.com/u/djprog)
#### Post date: [August 17, 2019, 1:26pm UTC](https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488/1 "2019-08-17T13:26:46Z")

</div>

Hello guys,

I’m aware of the method of looping through all the form fields to find out if a field is hidden like that:

> **[Using the gform\_validation Hook - Gravity Forms Documentation](https://docs.gravityforms.com/using-gform-validation-hook/#looping-through-the-fields)**
>
> The gform\_valiation hook will allow you to modify how your forms are validated. In this article, we will show you the gform\_validation hook which will allow you to apply custom form validation to your form field inputs.

  

> **[Using the gform\_validation Hook - Gravity Forms Documentation](https://docs.gravityforms.com/using-gform-validation-hook/#is-the-field-hidden-)**
>
> The gform\_valiation hook will allow you to modify how your forms are validated. In this article, we will show you the gform\_validation hook which will allow you to apply custom form validation to your form field inputs.

But is there no (more efficient) way to know if a field is visible or not?

Is there no way to have something similar to this:

$is\_hidden = RGFormsModel::is\_field\_hidden( $form, $field, array() );

But by just passing as parameters the $form and the field ID, e.g. input\_19 ?

Thanks,

---

<div class="post-metadata">

### Author: ![david](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/david/32/2517_2.png) [@david](https://community.gravityforms.com/u/david)
#### Post date: [August 18, 2019, 10:49pm UTC](https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488/2 "2019-08-18T22:49:32Z")

</div>

You could do something like:

```auto
$is_hidden = RGFormsModel::is_field_hidden( $form, GFAPI::get_field( $form, 19 ), array() );

```

---

<div class="post-metadata">

### Author: ![djprog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/djprog/32/935_2.png) [@djprog](https://community.gravityforms.com/u/djprog)
#### Post date: [August 19, 2019, 7:19am UTC](https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488/3 "2019-08-19T07:19:12Z")

</div>

Awesome thanks, I knew there was a cleaner way!!

---

<div class="post-metadata">

### Author: ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)
#### Post date: [August 19, 2019, 6:56pm UTC](https://community.gravityforms.com/t/check-if-field-hidden-without-looping-through-the-form-fields-resolved/2488/4 "2019-08-19T18:56:51Z")

</div>


