PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Check if Form Exists

  1. Is there a function to see if a form with a specific name exists?

    I'm using <?php gravity_form(the_title('','',false), false, false, false, '', false); ?> to display a form that has the same name as a product from my store. I want to do a check to see if the form exists before displaying the form. Not all products will have their own form, but most will.

    Posted 11 years ago on Thursday April 18, 2013 | Permalink
  2. I figured this out...
    I put this in my functions.php and just called it on the page I was displaying the form:

    function mwn_gravity_form_exists($form_name){
    
      $forms = GFFormsModel::get_forms();
    	foreach($forms as &$form){
    		if ($form->title == $form_name) {
    			return true;
    		}
    	}
      return false;
    }
    Posted 11 years ago on Tuesday April 23, 2013 | Permalink