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.

Dynamic population: what to do if value not present

  1. webmaster@hightouchinc.com
    Member

    I need to be able to display a certain message if a value in the querystring isn't available. I don't want the form to be shown. Looked through hooks and didn't necessarily see what I was looking for. But basically if the URL looks like /formpage/ rather than /formpage/?myval=1, I want to display a message rather than the form.

    Posted 12 years ago on Monday October 15, 2012 | Permalink
  2. webmaster@hightouchinc.com
    Member

    Just to give a bit more info, I have this:

    add_filter("gform_pre_render", "check_dynamic_values");
    function check_dynamic_values($form){
    	if(isset($_GET['myval']))
    		return $form;
    
    }

    Just not sure what to do to override the "Oops! We could not locate your form." error message

    Posted 12 years ago on Monday October 15, 2012 | Permalink
  3. webmaster@hightouchinc.com
    Member

    And on further thought, there's several things I could do rather than just hijack the error message. I could alter the field this goes in to display a drop down of all the possible values and have them pick one or show a different form as well. What's your thoughts?

    Posted 12 years ago on Monday October 15, 2012 | Permalink
  4. I like the ideas in your third post best. From your initial question, what you want to do will happen outside of Gravity Forms. You will have to conditionally include the form in the page (either the form or the error message) based on the presence of that $_GET value. Instead of using a Gravity Form filter as you showed in your second post, you would do the same sort of conditional check, but then use the function call to embed the form, or show your error message.

    However, that is not very helpful. I like the ideas in your third post best: show the form with all the possible values in the drop down and let the user select.

    Posted 12 years ago on Tuesday October 16, 2012 | Permalink