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

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:


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,

You could do something like:

$is_hidden = RGFormsModel::is_field_hidden( $form, GFAPI::get_field( $form, 19 ), array() );
2 Likes

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

1 Like